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

from __future__ import annotations
from .transferdocumentownershipresponse import (
    TransferDocumentOwnershipResponse,
    TransferDocumentOwnershipResponseTypedDict,
)
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 TransferDocumentOwnershipTransferDocumentOwnershipRequestTypedDict(TypedDict):
    r"""TransferDocumentOwnershipRequest specifies the document and new owner."""

    new_owner_id: NotRequired[str]
    r"""User ID of the new owner."""


class TransferDocumentOwnershipTransferDocumentOwnershipRequest(BaseModel):
    r"""TransferDocumentOwnershipRequest specifies the document and new owner."""

    new_owner_id: Optional[str] = None
    r"""User ID of the new owner."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["new_owner_id"])
        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 TransferDocumentOwnershipRequestTypedDict(TypedDict):
    document_id: str
    r"""Document ID."""
    body: TransferDocumentOwnershipTransferDocumentOwnershipRequestTypedDict


class TransferDocumentOwnershipRequest(BaseModel):
    document_id: Annotated[
        str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
    ]
    r"""Document ID."""

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


class TransferDocumentOwnershipResponseResponseTypedDict(TypedDict):
    headers: Dict[str, List[str]]
    result: TransferDocumentOwnershipResponseTypedDict


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

    result: TransferDocumentOwnershipResponse
