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

from __future__ import annotations

import datetime as dt
import typing

from ...core.datetime_utils import serialize_datetime
from ...core.pydantic_utilities import pydantic_v1
from ...generated_types.types.attribute_details import AttributeDetails
from .company_type import CompanyType
from .embedded_entity import EmbeddedEntity
from .entity_hs_code import EntityHsCode
from .entity_registration_date import EntityRegistrationDate
from .entity_risk import EntityRisk
from .entity_translated_label import EntityTranslatedLabel
from .possibly_same_as import PossiblySameAs
from .referenced_by import ReferencedBy
from .shipment_arrival import ShipmentArrival
from .shipment_departure import ShipmentDeparture
from .status import Status


class EntityDetails(EmbeddedEntity):
    """
    Additional fields providing more details about an entity
    """

    registration_date: typing.Optional[EntityRegistrationDate] = None
    translated_label: typing.Optional[EntityTranslatedLabel] = None
    hs_code: typing.Optional[EntityHsCode] = None
    shipment_arrival: typing.Optional[ShipmentArrival] = None
    shipment_departure: typing.Optional[ShipmentDeparture] = None
    company_type: typing.Optional[CompanyType] = None
    latest_status: typing.Optional[Status] = None
    risk: EntityRisk = pydantic_v1.Field()
    """
    [Risk factors](/sayari-library/ontology/risk-factors) associated with the entity.
    """

    attributes: typing.Optional[AttributeDetails] = pydantic_v1.Field(default=None)
    """
    Detailed information about the entity's [attributes](/sayari-library/ontology/attributes).
    """

    relationships: typing.Optional[EntityRelationships] = pydantic_v1.Field(default=None)
    """
    Detailed information about the entity's [relationships](/sayari-library/ontology/relationships).
    """

    possibly_same_as: typing.Optional[PossiblySameAs] = None
    referenced_by: typing.Optional[ReferencedBy] = None

    def json(self, **kwargs: typing.Any) -> str:
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        return super().json(**kwargs_with_defaults)

    def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        return super().dict(**kwargs_with_defaults)

    class Config:
        frozen = True
        smart_union = True
        allow_population_by_field_name = True
        populate_by_name = True
        extra = pydantic_v1.Extra.allow
        json_encoders = {dt.datetime: serialize_datetime}


from .entity_relationships import EntityRelationships  # noqa: E402

EntityDetails.update_forward_refs()
