# 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.relationships import Relationships
from .relationship_info import RelationshipInfo


class RelationshipData(pydantic_v1.BaseModel):
    target: EntityDetails
    types: typing.Dict[Relationships, typing.List[RelationshipInfo]] = pydantic_v1.Field()
    """
    Additional information for each [relationship type](/sayari-library/ontology/relationships).
    """

    dates: typing.List[str]
    first_observed: typing.Optional[str] = None
    former: typing.Optional[bool] = None
    last_observed: typing.Optional[str] = None
    start_date: typing.Optional[str] = None
    end_date: typing.Optional[str] = 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
        extra = pydantic_v1.Extra.allow
        json_encoders = {dt.datetime: serialize_datetime}


from .entity_details import EntityDetails  # noqa: E402

RelationshipData.update_forward_refs()
