"""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, QueryParamMetadata
from pydantic import model_serializer
from typing import List, Literal, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class GetV2MeetingsMeetingIDCallRecordingsRequestTypedDict(TypedDict):
    meeting_id: str
    limit: NotRequired[int]
    cursor: NotRequired[str]


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

    limit: Annotated[
        Optional[int],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None

    cursor: Annotated[
        Optional[str],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["limit", "cursor"])
        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 GetV2MeetingsMeetingIDCallRecordingsIDTypedDict(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 GetV2MeetingsMeetingIDCallRecordingsID(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."""


GetV2MeetingsMeetingIDCallRecordingsStatus = 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`."""


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


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

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


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

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

    type: OptionalNullable[GetV2MeetingsMeetingIDCallRecordingsType] = 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 GetV2MeetingsMeetingIDCallRecordingsDataTypedDict(TypedDict):
    id: GetV2MeetingsMeetingIDCallRecordingsIDTypedDict
    status: GetV2MeetingsMeetingIDCallRecordingsStatus
    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: GetV2MeetingsMeetingIDCallRecordingsCreatedByActorTypedDict
    r"""The actor that created this call recording."""
    created_at: str
    r"""The timestamp of when the call recording was created."""


class GetV2MeetingsMeetingIDCallRecordingsData(BaseModel):
    id: GetV2MeetingsMeetingIDCallRecordingsID

    status: GetV2MeetingsMeetingIDCallRecordingsStatus
    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: GetV2MeetingsMeetingIDCallRecordingsCreatedByActor
    r"""The actor that created this call recording."""

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


class GetV2MeetingsMeetingIDCallRecordingsPaginationTypedDict(TypedDict):
    next_cursor: Nullable[str]


class GetV2MeetingsMeetingIDCallRecordingsPagination(BaseModel):
    next_cursor: Nullable[str]

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        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:
                m[k] = val

        return m


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

    data: List[GetV2MeetingsMeetingIDCallRecordingsDataTypedDict]
    pagination: GetV2MeetingsMeetingIDCallRecordingsPaginationTypedDict


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

    data: List[GetV2MeetingsMeetingIDCallRecordingsData]

    pagination: GetV2MeetingsMeetingIDCallRecordingsPagination
