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

from __future__ import annotations
from attio.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
from attio.utils import FieldMetadata, PathParamMetadata, RequestMetadata
from pydantic import model_serializer
from typing import Literal, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict


class PostV2MeetingsMeetingIDCallRecordingsDataRequestTypedDict(TypedDict):
    video_url: str
    r"""A publicly accessible URL to a video file of the call recording. Attio will download the video from this URL asynchronously.

    **Requirements:**
    - **Protocol:** The URL must use the `https` protocol.
    - **File type:** The file must be a `.mp4` file.
    - **File size:** The file must not exceed 500MB in size.
    - **Accessibility:** For the request to be accepted, the URL must be publicly accessible. Attio will make a `HEAD` request to the URL to verify its accessibility and retrieve file metadata. The response to this request must include a `Content-Length` header.
    """


class PostV2MeetingsMeetingIDCallRecordingsDataRequest(BaseModel):
    video_url: str
    r"""A publicly accessible URL to a video file of the call recording. Attio will download the video from this URL asynchronously.

    **Requirements:**
    - **Protocol:** The URL must use the `https` protocol.
    - **File type:** The file must be a `.mp4` file.
    - **File size:** The file must not exceed 500MB in size.
    - **Accessibility:** For the request to be accepted, the URL must be publicly accessible. Attio will make a `HEAD` request to the URL to verify its accessibility and retrieve file metadata. The response to this request must include a `Content-Length` header.
    """


class PostV2MeetingsMeetingIDCallRecordingsRequestBodyTypedDict(TypedDict):
    data: PostV2MeetingsMeetingIDCallRecordingsDataRequestTypedDict


class PostV2MeetingsMeetingIDCallRecordingsRequestBody(BaseModel):
    data: PostV2MeetingsMeetingIDCallRecordingsDataRequest


class PostV2MeetingsMeetingIDCallRecordingsRequestTypedDict(TypedDict):
    meeting_id: str
    request_body: PostV2MeetingsMeetingIDCallRecordingsRequestBodyTypedDict


class PostV2MeetingsMeetingIDCallRecordingsRequest(BaseModel):
    meeting_id: Annotated[
        str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
    ]

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


PostV2MeetingsMeetingIDCallRecordingsNotFoundType = Literal["invalid_request_error",]


PostV2MeetingsMeetingIDCallRecordingsNotFoundCode = Literal["not_found",]


PostV2MeetingsMeetingIDCallRecordingsForbiddenType = Literal["auth_error",]


CodeQuotaExceeded = Literal["quota_exceeded",]


PostV2MeetingsMeetingIDCallRecordingsCodeBillingError = Literal["billing_error",]


CodeTypedDict = TypeAliasType(
    "CodeTypedDict",
    Union[PostV2MeetingsMeetingIDCallRecordingsCodeBillingError, CodeQuotaExceeded],
)


Code = TypeAliasType(
    "Code",
    Union[PostV2MeetingsMeetingIDCallRecordingsCodeBillingError, CodeQuotaExceeded],
)


PostV2MeetingsMeetingIDCallRecordingsBadRequestType = Literal["invalid_request_error",]


PostV2MeetingsMeetingIDCallRecordingsCodeValidationType = Literal["validation_type",]


class PostV2MeetingsMeetingIDCallRecordingsIDTypedDict(TypedDict):
    workspace_id: str
    r"""The ID of the workspace this call recording belongs to."""
    meeting_id: str
    r"""The ID of the meeting associated with this call recording."""
    call_recording_id: str
    r"""The call recording ID of the call recording."""


class PostV2MeetingsMeetingIDCallRecordingsID(BaseModel):
    workspace_id: str
    r"""The ID of the workspace this call recording belongs to."""

    meeting_id: str
    r"""The ID of the meeting associated with this call recording."""

    call_recording_id: str
    r"""The call recording ID of the call recording."""


PostV2MeetingsMeetingIDCallRecordingsStatus = Literal[
    "processing",
    "completed",
    "failed",
]
r"""The status of the call recording. When a call recording is first created, it will have a status of `PROCESSING`. Once the recording is ready, it will transition to `COMPLETED`. If the recording fails for any reason, the status will be `FAILED`."""


PostV2MeetingsMeetingIDCallRecordingsCreatedByActorType = Literal[
    "api-token",
    "workspace-member",
    "system",
    "app",
]
r"""The type of actor. [Read more information on actor types here](/docs/actors)."""


class PostV2MeetingsMeetingIDCallRecordingsCreatedByActorTypedDict(TypedDict):
    r"""The actor that created this call recording."""

    id: NotRequired[Nullable[str]]
    r"""An ID to identify the actor."""
    type: NotRequired[Nullable[PostV2MeetingsMeetingIDCallRecordingsCreatedByActorType]]
    r"""The type of actor. [Read more information on actor types here](/docs/actors)."""


class PostV2MeetingsMeetingIDCallRecordingsCreatedByActor(BaseModel):
    r"""The actor that created this call recording."""

    id: OptionalNullable[str] = UNSET
    r"""An ID to identify the actor."""

    type: OptionalNullable[PostV2MeetingsMeetingIDCallRecordingsCreatedByActorType] = (
        UNSET
    )
    r"""The type of actor. [Read more information on actor types here](/docs/actors)."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["id", "type"])
        nullable_fields = set(["id", "type"])
        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 PostV2MeetingsMeetingIDCallRecordingsDataResponseTypedDict(TypedDict):
    id: PostV2MeetingsMeetingIDCallRecordingsIDTypedDict
    status: PostV2MeetingsMeetingIDCallRecordingsStatus
    r"""The status of the call recording. When a call recording is first created, it will have a status of `PROCESSING`. Once the recording is ready, it will transition to `COMPLETED`. If the recording fails for any reason, the status will be `FAILED`."""
    web_url: str
    r"""A URL that links directly to the call recording in the Attio web application."""
    created_by_actor: PostV2MeetingsMeetingIDCallRecordingsCreatedByActorTypedDict
    r"""The actor that created this call recording."""
    created_at: str
    r"""The timestamp of when the call recording was created."""


class PostV2MeetingsMeetingIDCallRecordingsDataResponse(BaseModel):
    id: PostV2MeetingsMeetingIDCallRecordingsID

    status: PostV2MeetingsMeetingIDCallRecordingsStatus
    r"""The status of the call recording. When a call recording is first created, it will have a status of `PROCESSING`. Once the recording is ready, it will transition to `COMPLETED`. If the recording fails for any reason, the status will be `FAILED`."""

    web_url: str
    r"""A URL that links directly to the call recording in the Attio web application."""

    created_by_actor: PostV2MeetingsMeetingIDCallRecordingsCreatedByActor
    r"""The actor that created this call recording."""

    created_at: str
    r"""The timestamp of when the call recording was created."""


class PostV2MeetingsMeetingIDCallRecordingsResponseTypedDict(TypedDict):
    r"""Success"""

    data: PostV2MeetingsMeetingIDCallRecordingsDataResponseTypedDict


class PostV2MeetingsMeetingIDCallRecordingsResponse(BaseModel):
    r"""Success"""

    data: PostV2MeetingsMeetingIDCallRecordingsDataResponse
