from __future__ import annotations

from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, TypeVar, cast

from attrs import define as _attrs_define
from attrs import field as _attrs_field

from ..types import UNSET, Unset

if TYPE_CHECKING:
    from ..models.types_meeting_attendee import TypesMeetingAttendee
    from ..models.types_meeting_transcript_speech import TypesMeetingTranscriptSpeech


T = TypeVar("T", bound="TypesMeeting")


@_attrs_define
class TypesMeeting:
    """
    Attributes:
        field_id (str | Unset):
        added_tasks (list[str] | Unset):
        attendees (list[TypesMeetingAttendee] | Unset):
        client (str | Unset):
        created_at (str | Unset):
        date (str | Unset):
        deleted_at (str | Unset):
        duration (float | Unset):
        format_ (str | Unset):
        location (str | Unset):
        notes (str | Unset):
        raw_transcript (str | Unset):
        tasks (list[str] | Unset):
        team (str | Unset):
        transcript (list[TypesMeetingTranscriptSpeech] | Unset):
    """

    field_id: str | Unset = UNSET
    added_tasks: list[str] | Unset = UNSET
    attendees: list[TypesMeetingAttendee] | Unset = UNSET
    client: str | Unset = UNSET
    created_at: str | Unset = UNSET
    date: str | Unset = UNSET
    deleted_at: str | Unset = UNSET
    duration: float | Unset = UNSET
    format_: str | Unset = UNSET
    location: str | Unset = UNSET
    notes: str | Unset = UNSET
    raw_transcript: str | Unset = UNSET
    tasks: list[str] | Unset = UNSET
    team: str | Unset = UNSET
    transcript: list[TypesMeetingTranscriptSpeech] | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

    def to_dict(self) -> dict[str, Any]:
        field_id = self.field_id

        added_tasks: list[str] | Unset = UNSET
        if not isinstance(self.added_tasks, Unset):
            added_tasks = self.added_tasks

        attendees: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.attendees, Unset):
            attendees = []
            for attendees_item_data in self.attendees:
                attendees_item = attendees_item_data.to_dict()
                attendees.append(attendees_item)

        client = self.client

        created_at = self.created_at

        date = self.date

        deleted_at = self.deleted_at

        duration = self.duration

        format_ = self.format_

        location = self.location

        notes = self.notes

        raw_transcript = self.raw_transcript

        tasks: list[str] | Unset = UNSET
        if not isinstance(self.tasks, Unset):
            tasks = self.tasks

        team = self.team

        transcript: list[dict[str, Any]] | Unset = UNSET
        if not isinstance(self.transcript, Unset):
            transcript = []
            for transcript_item_data in self.transcript:
                transcript_item = transcript_item_data.to_dict()
                transcript.append(transcript_item)

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if field_id is not UNSET:
            field_dict["_id"] = field_id
        if added_tasks is not UNSET:
            field_dict["added_tasks"] = added_tasks
        if attendees is not UNSET:
            field_dict["attendees"] = attendees
        if client is not UNSET:
            field_dict["client"] = client
        if created_at is not UNSET:
            field_dict["created_at"] = created_at
        if date is not UNSET:
            field_dict["date"] = date
        if deleted_at is not UNSET:
            field_dict["deleted_at"] = deleted_at
        if duration is not UNSET:
            field_dict["duration"] = duration
        if format_ is not UNSET:
            field_dict["format"] = format_
        if location is not UNSET:
            field_dict["location"] = location
        if notes is not UNSET:
            field_dict["notes"] = notes
        if raw_transcript is not UNSET:
            field_dict["raw_transcript"] = raw_transcript
        if tasks is not UNSET:
            field_dict["tasks"] = tasks
        if team is not UNSET:
            field_dict["team"] = team
        if transcript is not UNSET:
            field_dict["transcript"] = transcript

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        from ..models.types_meeting_attendee import TypesMeetingAttendee
        from ..models.types_meeting_transcript_speech import TypesMeetingTranscriptSpeech

        d = dict(src_dict)
        field_id = d.pop("_id", UNSET)

        added_tasks = cast(list[str], d.pop("added_tasks", UNSET))

        _attendees = d.pop("attendees", UNSET)
        attendees: list[TypesMeetingAttendee] | Unset = UNSET
        if _attendees is not UNSET:
            attendees = []
            for attendees_item_data in _attendees:
                attendees_item = TypesMeetingAttendee.from_dict(attendees_item_data)

                attendees.append(attendees_item)

        client = d.pop("client", UNSET)

        created_at = d.pop("created_at", UNSET)

        date = d.pop("date", UNSET)

        deleted_at = d.pop("deleted_at", UNSET)

        duration = d.pop("duration", UNSET)

        format_ = d.pop("format", UNSET)

        location = d.pop("location", UNSET)

        notes = d.pop("notes", UNSET)

        raw_transcript = d.pop("raw_transcript", UNSET)

        tasks = cast(list[str], d.pop("tasks", UNSET))

        team = d.pop("team", UNSET)

        _transcript = d.pop("transcript", UNSET)
        transcript: list[TypesMeetingTranscriptSpeech] | Unset = UNSET
        if _transcript is not UNSET:
            transcript = []
            for transcript_item_data in _transcript:
                transcript_item = TypesMeetingTranscriptSpeech.from_dict(transcript_item_data)

                transcript.append(transcript_item)

        types_meeting = cls(
            field_id=field_id,
            added_tasks=added_tasks,
            attendees=attendees,
            client=client,
            created_at=created_at,
            date=date,
            deleted_at=deleted_at,
            duration=duration,
            format_=format_,
            location=location,
            notes=notes,
            raw_transcript=raw_transcript,
            tasks=tasks,
            team=team,
            transcript=transcript,
        )

        types_meeting.additional_properties = d
        return types_meeting

    @property
    def additional_keys(self) -> list[str]:
        return list(self.additional_properties.keys())

    def __getitem__(self, key: str) -> Any:
        return self.additional_properties[key]

    def __setitem__(self, key: str, value: Any) -> None:
        self.additional_properties[key] = value

    def __delitem__(self, key: str) -> None:
        del self.additional_properties[key]

    def __contains__(self, key: str) -> bool:
        return key in self.additional_properties
