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

from __future__ import annotations
from datetime import datetime
from moovio_sdk.types import BaseModel, UNSET_SENTINEL
import pydantic
from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class ResolutionLinkTypedDict(TypedDict):
    r"""A temporary, secure link sent to a merchant to resolve account requirements such as KYC verification or document uploads."""

    code: str
    r"""A unique nanoid identifier for the resolution link."""
    account_id: str
    r"""The ID of the merchant account this resolution link is associated with."""
    partner_account_id: str
    r"""The ID of the partner account this resolution link is associated with."""
    recipient: str
    r"""The recipient contact information for the resolution link."""
    url: str
    r"""The URL of the resolution link."""
    created_on: datetime
    r"""The date and time the resolution link was created."""
    updated_on: datetime
    r"""The date and time the resolution link was last updated."""
    expires_on: datetime
    r"""The date and time the resolution link expires."""
    disabled_on: NotRequired[datetime]
    r"""The date and time the resolution link was disabled, if applicable."""


class ResolutionLink(BaseModel):
    r"""A temporary, secure link sent to a merchant to resolve account requirements such as KYC verification or document uploads."""

    code: str
    r"""A unique nanoid identifier for the resolution link."""

    account_id: Annotated[str, pydantic.Field(alias="accountID")]
    r"""The ID of the merchant account this resolution link is associated with."""

    partner_account_id: Annotated[str, pydantic.Field(alias="partnerAccountID")]
    r"""The ID of the partner account this resolution link is associated with."""

    recipient: str
    r"""The recipient contact information for the resolution link."""

    url: str
    r"""The URL of the resolution link."""

    created_on: Annotated[datetime, pydantic.Field(alias="createdOn")]
    r"""The date and time the resolution link was created."""

    updated_on: Annotated[datetime, pydantic.Field(alias="updatedOn")]
    r"""The date and time the resolution link was last updated."""

    expires_on: Annotated[datetime, pydantic.Field(alias="expiresOn")]
    r"""The date and time the resolution link expires."""

    disabled_on: Annotated[Optional[datetime], pydantic.Field(alias="disabledOn")] = (
        None
    )
    r"""The date and time the resolution link was disabled, if applicable."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["disabledOn"])
        serialized = handler(self)
        m = {}

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

            if val != UNSET_SENTINEL:
                if val is not None or k not in optional_fields:
                    m[k] = val

        return m


try:
    ResolutionLink.model_rebuild()
except NameError:
    pass
