# This file was auto-generated by Fern from our API Definition.

from __future__ import annotations

import datetime as dt
import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel, update_forward_refs
from ..core.serialization import FieldMetadata
from .override_status import OverrideStatus
from .override_type import OverrideType
from .provenance import Provenance


class Override(UniversalBaseModel):
    """
    Details about an override. Last write wins.
    """

    request_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="requestId")] = pydantic.Field(
        default=None
    )
    """
    override request id for an override request
    """

    field_path: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="fieldPath")] = pydantic.Field(
        default=None
    )
    """
    proto field path which is the string representation of a field.
     example: correlated.primary_entity_id would be primary_entity_id in correlated component
    """

    masked_field_value: typing_extensions.Annotated[
        typing.Optional["Entity"], FieldMetadata(alias="maskedFieldValue")
    ] = pydantic.Field(default=None)
    """
    new field value corresponding to field path. In the shape of an empty entity with only the changed value.
     example: entity: { mil_view: { disposition: Disposition_DISPOSITION_HOSTILE } }
    """

    status: typing.Optional[OverrideStatus] = pydantic.Field(default=None)
    """
    status of the override
    """

    provenance: typing.Optional[Provenance] = None
    type: typing.Optional[OverrideType] = pydantic.Field(default=None)
    """
    The type of the override, defined by the stage of the entity lifecycle that the entity was in when the override
     was requested.
    """

    request_timestamp: typing_extensions.Annotated[
        typing.Optional[dt.datetime], FieldMetadata(alias="requestTimestamp")
    ] = pydantic.Field(default=None)
    """
    Timestamp of the override request. The timestamp is generated by the Entity Manager instance that receives the request.
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow


from .entity import Entity  # noqa: E402, F401, I001
from .overrides import Overrides  # noqa: E402, F401, I001

update_forward_refs(Override)
