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

from __future__ import annotations
from .downloadablefileread import DownloadableFileRead, DownloadableFileReadTypedDict
from .filepatch import FilePatch, FilePatchTypedDict
from .organizationavatarfileread import (
    OrganizationAvatarFileRead,
    OrganizationAvatarFileReadTypedDict,
)
from .productmediafileread import ProductMediaFileRead, ProductMediaFileReadTypedDict
from macropay_sdk.types import BaseModel
from macropay_sdk.utils import (
    FieldMetadata,
    PathParamMetadata,
    RequestMetadata,
    get_discriminator,
)
from pydantic import Discriminator, Tag
from typing import Union
from typing_extensions import Annotated, TypeAliasType, TypedDict


class FilesUpdateRequestTypedDict(TypedDict):
    id: str
    r"""The file ID."""
    file_patch: FilePatchTypedDict


class FilesUpdateRequest(BaseModel):
    id: Annotated[
        str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
    ]
    r"""The file ID."""

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


FilesUpdateResponseFilesUpdateTypedDict = TypeAliasType(
    "FilesUpdateResponseFilesUpdateTypedDict",
    Union[
        DownloadableFileReadTypedDict,
        ProductMediaFileReadTypedDict,
        OrganizationAvatarFileReadTypedDict,
    ],
)
r"""File updated."""


FilesUpdateResponseFilesUpdate = Annotated[
    Union[
        Annotated[DownloadableFileRead, Tag("downloadable")],
        Annotated[ProductMediaFileRead, Tag("product_media")],
        Annotated[OrganizationAvatarFileRead, Tag("organization_avatar")],
    ],
    Discriminator(lambda m: get_discriminator(m, "service", "service")),
]
r"""File updated."""
