"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .addressdetail import AddressDetail, AddressDetailTypedDict
from .countrydetail import CountryDetail, CountryDetailTypedDict
from .descriptiondetail import DescriptionDetail, DescriptionDetailTypedDict
from .dowjonesdate import DowJonesDate, DowJonesDateTypedDict
from .identificationdetail import IdentificationDetail, IdentificationDetailTypedDict
from .namedetail import NameDetail, NameDetailTypedDict
from .relatedprofile import RelatedProfile, RelatedProfileTypedDict
from .roledetail import RoleDetail, RoleDetailTypedDict
from .sanctionslistdetail import SanctionsListDetail, SanctionsListDetailTypedDict
from ascend_sdk.types import (
    BaseModel,
    Nullable,
    OptionalNullable,
    UNSET,
    UNSET_SENTINEL,
)
from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import NotRequired, TypedDict


class CreatedDateTypedDict(TypedDict):
    r"""date this person was added to the DNDB list"""

    day: NotRequired[int]
    r"""Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant."""
    month: NotRequired[int]
    r"""Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day."""
    year: NotRequired[int]
    r"""Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year."""


class CreatedDate(BaseModel):
    r"""date this person was added to the DNDB list"""

    day: Optional[int] = None
    r"""Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant."""

    month: Optional[int] = None
    r"""Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day."""

    year: Optional[int] = None
    r"""Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year."""


class DobTypedDict(TypedDict):
    r"""DNDB persons date of birth"""

    day: NotRequired[int]
    r"""Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant."""
    month: NotRequired[int]
    r"""Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day."""
    year: NotRequired[int]
    r"""Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year."""


class Dob(BaseModel):
    r"""DNDB persons date of birth"""

    day: Optional[int] = None
    r"""Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant."""

    month: Optional[int] = None
    r"""Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day."""

    year: Optional[int] = None
    r"""Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year."""


class EndDateTypedDict(TypedDict):
    r"""date this person will be removed from the DNDB list"""

    day: NotRequired[int]
    r"""Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant."""
    month: NotRequired[int]
    r"""Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day."""
    year: NotRequired[int]
    r"""Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year."""


class EndDate(BaseModel):
    r"""date this person will be removed from the DNDB list"""

    day: Optional[int] = None
    r"""Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant."""

    month: Optional[int] = None
    r"""Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day."""

    year: Optional[int] = None
    r"""Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year."""


class DndbDetailsTypedDict(TypedDict):
    r"""Dndb details"""

    business_nm: NotRequired[str]
    r"""DNDB persons business name"""
    comments: NotRequired[str]
    r"""reason why person exists in DNDB list"""
    create_user: NotRequired[str]
    r"""person that created this record for the DNDB list"""
    created_date: NotRequired[Nullable[CreatedDateTypedDict]]
    r"""date this person was added to the DNDB list"""
    dob: NotRequired[Nullable[DobTypedDict]]
    r"""DNDB persons date of birth"""
    email: NotRequired[str]
    r"""DNDB persons email address"""
    end_date: NotRequired[Nullable[EndDateTypedDict]]
    r"""date this person will be removed from the DNDB list"""
    first_nm: NotRequired[str]
    r"""DNDB persons first name"""
    id: NotRequired[int]
    r"""DNDB profile person id"""
    last_nm: NotRequired[str]
    r"""DNDB persons last name"""
    middle_nm: NotRequired[str]
    r"""DNDB persons middle name"""
    ssn: NotRequired[str]
    r"""DNDB persons ssn number"""
    telephone: NotRequired[str]
    r"""DNDB persons telephone number"""
    tin: NotRequired[str]
    r"""DNDB persons tin number"""


class DndbDetails(BaseModel):
    r"""Dndb details"""

    business_nm: Optional[str] = None
    r"""DNDB persons business name"""

    comments: Optional[str] = None
    r"""reason why person exists in DNDB list"""

    create_user: Optional[str] = None
    r"""person that created this record for the DNDB list"""

    created_date: OptionalNullable[CreatedDate] = UNSET
    r"""date this person was added to the DNDB list"""

    dob: OptionalNullable[Dob] = UNSET
    r"""DNDB persons date of birth"""

    email: Optional[str] = None
    r"""DNDB persons email address"""

    end_date: OptionalNullable[EndDate] = UNSET
    r"""date this person will be removed from the DNDB list"""

    first_nm: Optional[str] = None
    r"""DNDB persons first name"""

    id: Optional[int] = None
    r"""DNDB profile person id"""

    last_nm: Optional[str] = None
    r"""DNDB persons last name"""

    middle_nm: Optional[str] = None
    r"""DNDB persons middle name"""

    ssn: Optional[str] = None
    r"""DNDB persons ssn number"""

    telephone: Optional[str] = None
    r"""DNDB persons telephone number"""

    tin: Optional[str] = None
    r"""DNDB persons tin number"""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = [
            "business_nm",
            "comments",
            "create_user",
            "created_date",
            "dob",
            "email",
            "end_date",
            "first_nm",
            "id",
            "last_nm",
            "middle_nm",
            "ssn",
            "telephone",
            "tin",
        ]
        nullable_fields = ["created_date", "dob", "end_date"]
        null_default_fields = []

        serialized = handler(self)

        m = {}

        for n, f in self.model_fields.items():
            k = f.alias or n
            val = serialized.get(k)
            serialized.pop(k, None)

            optional_nullable = k in optional_fields and k in nullable_fields
            is_set = (
                self.__pydantic_fields_set__.intersection({n})
                or k in null_default_fields
            )  # pylint: disable=no-member

            if val is not None and val != UNSET_SENTINEL:
                m[k] = val
            elif val != UNSET_SENTINEL and (
                not k in optional_fields or (optional_nullable and is_set)
            ):
                m[k] = val

        return m


class LastChangedDateTypedDict(TypedDict):
    r"""Date profile was last updated"""

    day: NotRequired[str]
    r"""Day"""
    month: NotRequired[str]
    r"""Month"""
    year: NotRequired[str]
    r"""Year"""


class LastChangedDate(BaseModel):
    r"""Date profile was last updated"""

    day: Optional[str] = None
    r"""Day"""

    month: Optional[str] = None
    r"""Month"""

    year: Optional[str] = None
    r"""Year"""


class DowJonesDetailsTypedDict(TypedDict):
    r"""Dow Jones details"""

    active_status: NotRequired[str]
    r"""Active status of matched profile"""
    address_details: NotRequired[List[AddressDetailTypedDict]]
    r"""Corresponding address details"""
    birth_dates: NotRequired[List[DowJonesDateTypedDict]]
    r"""Dates of birth"""
    birth_places: NotRequired[List[str]]
    r"""Corresponding birth places"""
    country_details: NotRequired[List[CountryDetailTypedDict]]
    r"""Corresponding country details"""
    deceased: NotRequired[str]
    r"""If corresponding person is deceased"""
    deceased_dates: NotRequired[List[DowJonesDateTypedDict]]
    r"""Dates of death"""
    description_details: NotRequired[List[DescriptionDetailTypedDict]]
    r"""Corresponding description details"""
    dow_jones_person_id: NotRequired[int]
    r"""Dow Jones profile person id"""
    gender: NotRequired[str]
    r"""Gender of person"""
    identifications: NotRequired[List[IdentificationDetailTypedDict]]
    r"""Corresponding identifications"""
    images: NotRequired[List[str]]
    r"""Images relating to profile"""
    last_changed_date: NotRequired[Nullable[LastChangedDateTypedDict]]
    r"""Date profile was last updated"""
    name_details: NotRequired[List[NameDetailTypedDict]]
    r"""Name details associated with profile"""
    profile_notes: NotRequired[str]
    r"""Associated profile notes"""
    related_profiles: NotRequired[List[RelatedProfileTypedDict]]
    r"""Related profiles"""
    role_details: NotRequired[List[RoleDetailTypedDict]]
    r"""Corresponding role details"""
    sanctions_list_details: NotRequired[List[SanctionsListDetailTypedDict]]
    r"""Corresponding sanctions list details"""
    sources: NotRequired[List[str]]
    r"""Sources relating to profile"""


class DowJonesDetails(BaseModel):
    r"""Dow Jones details"""

    active_status: Optional[str] = None
    r"""Active status of matched profile"""

    address_details: Optional[List[AddressDetail]] = None
    r"""Corresponding address details"""

    birth_dates: Optional[List[DowJonesDate]] = None
    r"""Dates of birth"""

    birth_places: Optional[List[str]] = None
    r"""Corresponding birth places"""

    country_details: Optional[List[CountryDetail]] = None
    r"""Corresponding country details"""

    deceased: Optional[str] = None
    r"""If corresponding person is deceased"""

    deceased_dates: Optional[List[DowJonesDate]] = None
    r"""Dates of death"""

    description_details: Optional[List[DescriptionDetail]] = None
    r"""Corresponding description details"""

    dow_jones_person_id: Optional[int] = None
    r"""Dow Jones profile person id"""

    gender: Optional[str] = None
    r"""Gender of person"""

    identifications: Optional[List[IdentificationDetail]] = None
    r"""Corresponding identifications"""

    images: Optional[List[str]] = None
    r"""Images relating to profile"""

    last_changed_date: OptionalNullable[LastChangedDate] = UNSET
    r"""Date profile was last updated"""

    name_details: Optional[List[NameDetail]] = None
    r"""Name details associated with profile"""

    profile_notes: Optional[str] = None
    r"""Associated profile notes"""

    related_profiles: Optional[List[RelatedProfile]] = None
    r"""Related profiles"""

    role_details: Optional[List[RoleDetail]] = None
    r"""Corresponding role details"""

    sanctions_list_details: Optional[List[SanctionsListDetail]] = None
    r"""Corresponding sanctions list details"""

    sources: Optional[List[str]] = None
    r"""Sources relating to profile"""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = [
            "active_status",
            "address_details",
            "birth_dates",
            "birth_places",
            "country_details",
            "deceased",
            "deceased_dates",
            "description_details",
            "dow_jones_person_id",
            "gender",
            "identifications",
            "images",
            "last_changed_date",
            "name_details",
            "profile_notes",
            "related_profiles",
            "role_details",
            "sanctions_list_details",
            "sources",
        ]
        nullable_fields = ["last_changed_date"]
        null_default_fields = []

        serialized = handler(self)

        m = {}

        for n, f in self.model_fields.items():
            k = f.alias or n
            val = serialized.get(k)
            serialized.pop(k, None)

            optional_nullable = k in optional_fields and k in nullable_fields
            is_set = (
                self.__pydantic_fields_set__.intersection({n})
                or k in null_default_fields
            )  # pylint: disable=no-member

            if val is not None and val != UNSET_SENTINEL:
                m[k] = val
            elif val != UNSET_SENTINEL and (
                not k in optional_fields or (optional_nullable and is_set)
            ):
                m[k] = val

        return m


class WatchlistItemTypedDict(TypedDict):
    r"""Watchlist details response"""

    dndb_details: NotRequired[Nullable[DndbDetailsTypedDict]]
    r"""Dndb details"""
    dow_jones_details: NotRequired[Nullable[DowJonesDetailsTypedDict]]
    r"""Dow Jones details"""
    name: NotRequired[str]
    r"""The resource identifier for the WatchlistItem The format is \"watchlists/{watchlist_id}/items/{watchlist_item_id}\" """
    watchlist: NotRequired[str]
    r"""Indicates the watchlist source for a given match"""
    watchlist_item: NotRequired[int]
    r"""Identification number for the watchlist item that was matched"""


class WatchlistItem(BaseModel):
    r"""Watchlist details response"""

    dndb_details: OptionalNullable[DndbDetails] = UNSET
    r"""Dndb details"""

    dow_jones_details: OptionalNullable[DowJonesDetails] = UNSET
    r"""Dow Jones details"""

    name: Optional[str] = None
    r"""The resource identifier for the WatchlistItem The format is \"watchlists/{watchlist_id}/items/{watchlist_item_id}\" """

    watchlist: Optional[str] = None
    r"""Indicates the watchlist source for a given match"""

    watchlist_item: Optional[int] = None
    r"""Identification number for the watchlist item that was matched"""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = [
            "dndb_details",
            "dow_jones_details",
            "name",
            "watchlist",
            "watchlist_item",
        ]
        nullable_fields = ["dndb_details", "dow_jones_details"]
        null_default_fields = []

        serialized = handler(self)

        m = {}

        for n, f in self.model_fields.items():
            k = f.alias or n
            val = serialized.get(k)
            serialized.pop(k, None)

            optional_nullable = k in optional_fields and k in nullable_fields
            is_set = (
                self.__pydantic_fields_set__.intersection({n})
                or k in null_default_fields
            )  # pylint: disable=no-member

            if val is not None and val != UNSET_SENTINEL:
                m[k] = val
            elif val != UNSET_SENTINEL and (
                not k in optional_fields or (optional_nullable and is_set)
            ):
                m[k] = val

        return m
