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

from __future__ import annotations
from dub.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
from enum import Enum
import pydantic
from pydantic import model_serializer
from typing_extensions import Annotated, NotRequired, TypedDict


class Reason(str, Enum):
    TOS_VIOLATION = "tos_violation"
    INAPPROPRIATE_CONTENT = "inappropriate_content"
    FAKE_TRAFFIC = "fake_traffic"
    FRAUD = "fraud"
    SPAM = "spam"
    BRAND_ABUSE = "brand_abuse"


class BanPartnerRequestBodyTypedDict(TypedDict):
    reason: Reason
    partner_id: NotRequired[Nullable[str]]
    r"""The ID of the partner to create a link for. Will take precedence over `tenantId` if provided."""
    tenant_id: NotRequired[Nullable[str]]
    r"""The ID of the partner in your system. If both `partnerId` and `tenantId` are not provided, an error will be thrown."""


class BanPartnerRequestBody(BaseModel):
    reason: Reason

    partner_id: Annotated[OptionalNullable[str], pydantic.Field(alias="partnerId")] = (
        UNSET
    )
    r"""The ID of the partner to create a link for. Will take precedence over `tenantId` if provided."""

    tenant_id: Annotated[OptionalNullable[str], pydantic.Field(alias="tenantId")] = (
        UNSET
    )
    r"""The ID of the partner in your system. If both `partnerId` and `tenantId` are not provided, an error will be thrown."""

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

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k)
            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 BanPartnerResponseBodyTypedDict(TypedDict):
    r"""The banned partner"""

    partner_id: str
    r"""The ID of the banned partner."""


class BanPartnerResponseBody(BaseModel):
    r"""The banned partner"""

    partner_id: Annotated[str, pydantic.Field(alias="partnerId")]
    r"""The ID of the banned partner."""
