"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
# @generated-id: a9c9d55160b5

from __future__ import annotations
from .address import Address, AddressTypedDict
from .onboarding_vat_regulation import OnboardingVatRegulation
from mollie.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
from mollie.utils import FieldMetadata, HeaderMetadata, RequestMetadata
import pydantic
from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class OrganizationTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The name of the organization."""
    address: NotRequired[AddressTypedDict]
    registration_number: NotRequired[str]
    r"""The registration number of the organization at their local chamber of commerce."""
    vat_number: NotRequired[Nullable[str]]
    r"""The VAT number of the organization, if based in the European Union or in The United Kingdom. VAT
    numbers are verified against the international registry *VIES*.

    The field can be omitted for merchants residing in other countries.
    """
    vat_regulation: NotRequired[Nullable[OnboardingVatRegulation]]
    r"""Mollie applies Dutch VAT for merchants based in The Netherlands, British VAT for merchants based in
    The United Kingdom, and shifted VAT for merchants in the European Union.

    The field can be omitted for merchants residing in other countries.
    """


class Organization(BaseModel):
    name: Optional[str] = None
    r"""The name of the organization."""

    address: Optional[Address] = None

    registration_number: Annotated[
        Optional[str], pydantic.Field(alias="registrationNumber")
    ] = None
    r"""The registration number of the organization at their local chamber of commerce."""

    vat_number: Annotated[OptionalNullable[str], pydantic.Field(alias="vatNumber")] = (
        UNSET
    )
    r"""The VAT number of the organization, if based in the European Union or in The United Kingdom. VAT
    numbers are verified against the international registry *VIES*.

    The field can be omitted for merchants residing in other countries.
    """

    vat_regulation: Annotated[
        OptionalNullable[OnboardingVatRegulation], pydantic.Field(alias="vatRegulation")
    ] = UNSET
    r"""Mollie applies Dutch VAT for merchants based in The Netherlands, British VAT for merchants based in
    The United Kingdom, and shifted VAT for merchants in the European Union.

    The field can be omitted for merchants residing in other countries.
    """

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(
            ["name", "address", "registrationNumber", "vatNumber", "vatRegulation"]
        )
        nullable_fields = set(["vatNumber", "vatRegulation"])
        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))
            is_nullable_and_explicitly_set = (
                k in nullable_fields
                and (self.__pydantic_fields_set__.intersection({n}))  # pylint: disable=no-member
            )

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

        return m


class ProfileTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The profile's name, this will usually reflect the trade name or brand name of the profile's website
    or application.
    """
    url: NotRequired[str]
    r"""The URL to the profile's website or application. Only `https` or `http` URLs are allowed. No `@`
    signs are allowed.
    """
    email: NotRequired[str]
    r"""The email address associated with the profile's trade name or brand."""
    phone: NotRequired[str]
    r"""The phone number associated with the profile's trade name or brand."""
    description: NotRequired[Nullable[str]]
    r"""The products or services offered by the profile's website or application."""
    business_category: NotRequired[str]
    r"""The industry associated with the profile's trade name or brand. Please refer to the
    [business category list](common-data-types) for all possible options.
    """


class Profile(BaseModel):
    name: Optional[str] = None
    r"""The profile's name, this will usually reflect the trade name or brand name of the profile's website
    or application.
    """

    url: Optional[str] = None
    r"""The URL to the profile's website or application. Only `https` or `http` URLs are allowed. No `@`
    signs are allowed.
    """

    email: Optional[str] = None
    r"""The email address associated with the profile's trade name or brand."""

    phone: Optional[str] = None
    r"""The phone number associated with the profile's trade name or brand."""

    description: OptionalNullable[str] = UNSET
    r"""The products or services offered by the profile's website or application."""

    business_category: Annotated[
        Optional[str], pydantic.Field(alias="businessCategory")
    ] = None
    r"""The industry associated with the profile's trade name or brand. Please refer to the
    [business category list](common-data-types) for all possible options.
    """

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(
            ["name", "url", "email", "phone", "description", "businessCategory"]
        )
        nullable_fields = set(["description"])
        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))
            is_nullable_and_explicitly_set = (
                k in nullable_fields
                and (self.__pydantic_fields_set__.intersection({n}))  # pylint: disable=no-member
            )

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

        return m


class SubmitOnboardingDataRequestBodyTypedDict(TypedDict):
    organization: NotRequired[OrganizationTypedDict]
    profile: NotRequired[ProfileTypedDict]


class SubmitOnboardingDataRequestBody(BaseModel):
    organization: Optional[Organization] = None

    profile: Optional[Profile] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["organization", "profile"])
        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


class SubmitOnboardingDataRequestTypedDict(TypedDict):
    idempotency_key: NotRequired[str]
    r"""A unique key to ensure idempotent requests. This key should be a UUID v4 string."""
    request_body: NotRequired[SubmitOnboardingDataRequestBodyTypedDict]


class SubmitOnboardingDataRequest(BaseModel):
    idempotency_key: Annotated[
        Optional[str],
        pydantic.Field(alias="idempotency-key"),
        FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
    ] = None
    r"""A unique key to ensure idempotent requests. This key should be a UUID v4 string."""

    request_body: Annotated[
        Optional[SubmitOnboardingDataRequestBody],
        FieldMetadata(request=RequestMetadata(media_type="application/json")),
    ] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["idempotency-key", "RequestBody"])
        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:
    Organization.model_rebuild()
except NameError:
    pass
try:
    Profile.model_rebuild()
except NameError:
    pass
