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

from __future__ import annotations
from .uploadorganizationlogoresponse import (
    UploadOrganizationLogoResponse,
    UploadOrganizationLogoResponseTypedDict,
)
from factify.types import BaseModel, UNSET_SENTINEL
from factify.utils import FieldMetadata, PathParamMetadata, RequestMetadata
from pydantic import model_serializer
from typing import Dict, List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class UploadOrganizationLogoUploadOrganizationLogoRequestTypedDict(TypedDict):
    r"""UploadOrganizationLogoRequest contains the logo image to upload."""

    content_type: NotRequired[str]
    r"""Informational content type. The server detects format from magic bytes."""
    image_data: NotRequired[str]
    r"""Raw image bytes. Maximum 2 MB. Accepted formats: JPEG, PNG, WebP, SVG."""


class UploadOrganizationLogoUploadOrganizationLogoRequest(BaseModel):
    r"""UploadOrganizationLogoRequest contains the logo image to upload."""

    content_type: Optional[str] = None
    r"""Informational content type. The server detects format from magic bytes."""

    image_data: Optional[str] = None
    r"""Raw image bytes. Maximum 2 MB. Accepted formats: JPEG, PNG, WebP, SVG."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["content_type", "image_data"])
        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 UploadOrganizationLogoRequestTypedDict(TypedDict):
    organization_id: str
    r"""Organization ID."""
    body: UploadOrganizationLogoUploadOrganizationLogoRequestTypedDict


class UploadOrganizationLogoRequest(BaseModel):
    organization_id: Annotated[
        str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
    ]
    r"""Organization ID."""

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


class UploadOrganizationLogoResponseResponseTypedDict(TypedDict):
    headers: Dict[str, List[str]]
    result: UploadOrganizationLogoResponseTypedDict


class UploadOrganizationLogoResponseResponse(BaseModel):
    headers: Dict[str, List[str]]

    result: UploadOrganizationLogoResponse
