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

from __future__ import annotations
from mollie.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
from mollie.utils import (
    FieldMetadata,
    HeaderMetadata,
    PathParamMetadata,
    RequestMetadata,
)
import pydantic
from pydantic import model_serializer
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class UpdateProfileRequestBodyTypedDict(TypedDict):
    name: NotRequired[Nullable[str]]
    r"""The profile's name, this will usually reflect the trade name or brand name of the profile's website or
    application.
    """
    website: NotRequired[Nullable[str]]
    r"""The URL to the profile's website or application. Only `https` or `http` URLs are allowed. No `@` signs
    are allowed.
    """
    email: NotRequired[Nullable[str]]
    r"""The email address associated with the profile's trade name or brand."""
    phone: NotRequired[Nullable[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."""
    countries_of_activity: NotRequired[Nullable[List[str]]]
    r"""A list of countries where you expect that the majority of the profile's customers reside,
    in [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format.
    """
    business_category: NotRequired[Nullable[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 UpdateProfileRequestBody(BaseModel):
    name: OptionalNullable[str] = UNSET
    r"""The profile's name, this will usually reflect the trade name or brand name of the profile's website or
    application.
    """

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

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

    phone: OptionalNullable[str] = UNSET
    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."""

    countries_of_activity: Annotated[
        OptionalNullable[List[str]], pydantic.Field(alias="countriesOfActivity")
    ] = UNSET
    r"""A list of countries where you expect that the majority of the profile's customers reside,
    in [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format.
    """

    business_category: Annotated[
        OptionalNullable[str], pydantic.Field(alias="businessCategory")
    ] = UNSET
    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",
                "website",
                "email",
                "phone",
                "description",
                "countriesOfActivity",
                "businessCategory",
            ]
        )
        nullable_fields = set(
            [
                "name",
                "website",
                "email",
                "phone",
                "description",
                "countriesOfActivity",
                "businessCategory",
            ]
        )
        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 UpdateProfileRequestTypedDict(TypedDict):
    profile_id: str
    r"""Provide the ID of the related profile."""
    request_body: UpdateProfileRequestBodyTypedDict
    idempotency_key: NotRequired[str]
    r"""A unique key to ensure idempotent requests. This key should be a UUID v4 string."""


class UpdateProfileRequest(BaseModel):
    profile_id: Annotated[
        str,
        pydantic.Field(alias="profileId"),
        FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
    ]
    r"""Provide the ID of the related profile."""

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

    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."""

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