from __future__ import annotations

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

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_client_summary_factors import TypesClientSummaryFactors
    from ..models.types_pulse import TypesPulse


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


@_attrs_define
class TypesClientSummary:
    """
    Attributes:
        field_id (str | Unset):
        client (str | Unset):
        date (str | Unset):
        factors (TypesClientSummaryFactors | Unset):
        pulse (TypesPulse | Unset):
        team (str | Unset):
    """

    field_id: str | Unset = UNSET
    client: str | Unset = UNSET
    date: str | Unset = UNSET
    factors: TypesClientSummaryFactors | Unset = UNSET
    pulse: TypesPulse | Unset = UNSET
    team: str | 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

        client = self.client

        date = self.date

        factors: dict[str, Any] | Unset = UNSET
        if not isinstance(self.factors, Unset):
            factors = self.factors.to_dict()

        pulse: dict[str, Any] | Unset = UNSET
        if not isinstance(self.pulse, Unset):
            pulse = self.pulse.to_dict()

        team = self.team

        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 client is not UNSET:
            field_dict["client"] = client
        if date is not UNSET:
            field_dict["date"] = date
        if factors is not UNSET:
            field_dict["factors"] = factors
        if pulse is not UNSET:
            field_dict["pulse"] = pulse
        if team is not UNSET:
            field_dict["team"] = team

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        from ..models.types_client_summary_factors import TypesClientSummaryFactors
        from ..models.types_pulse import TypesPulse

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

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

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

        _factors = d.pop("factors", UNSET)
        factors: TypesClientSummaryFactors | Unset
        if isinstance(_factors, Unset):
            factors = UNSET
        else:
            factors = TypesClientSummaryFactors.from_dict(_factors)

        _pulse = d.pop("pulse", UNSET)
        pulse: TypesPulse | Unset
        if isinstance(_pulse, Unset):
            pulse = UNSET
        else:
            pulse = TypesPulse.from_dict(_pulse)

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

        types_client_summary = cls(
            field_id=field_id,
            client=client,
            date=date,
            factors=factors,
            pulse=pulse,
            team=team,
        )

        types_client_summary.additional_properties = d
        return types_client_summary

    @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
