from __future__ import annotations

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

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

from ..types import UNSET, Unset

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


@_attrs_define
class TypesDistribution:
    """
    Attributes:
        field_id (str | Unset):
        amount (float | Unset):
        client (str | Unset):
        created_at (str | Unset): When user added it
        deleted_at (str | Unset):
        employee (str | Unset):
        first_name (str | Unset):
        last_name (str | Unset):
        plan (str | Unset):
        processed_at (str | Unset): When admin processed it
        processor (str | Unset):
        reason (str | Unset):
        requested_at (str | Unset): Dates
        source (str | Unset): Source of the distribution
        source_id (str | Unset): Source ID
        ssn (str | Unset): Internal use - for tracking employee reference during import
        status (str | Unset):
        team (str | Unset):
    """

    field_id: str | Unset = UNSET
    amount: float | Unset = UNSET
    client: str | Unset = UNSET
    created_at: str | Unset = UNSET
    deleted_at: str | Unset = UNSET
    employee: str | Unset = UNSET
    first_name: str | Unset = UNSET
    last_name: str | Unset = UNSET
    plan: str | Unset = UNSET
    processed_at: str | Unset = UNSET
    processor: str | Unset = UNSET
    reason: str | Unset = UNSET
    requested_at: str | Unset = UNSET
    source: str | Unset = UNSET
    source_id: str | Unset = UNSET
    ssn: str | Unset = UNSET
    status: str | 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

        amount = self.amount

        client = self.client

        created_at = self.created_at

        deleted_at = self.deleted_at

        employee = self.employee

        first_name = self.first_name

        last_name = self.last_name

        plan = self.plan

        processed_at = self.processed_at

        processor = self.processor

        reason = self.reason

        requested_at = self.requested_at

        source = self.source

        source_id = self.source_id

        ssn = self.ssn

        status = self.status

        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 amount is not UNSET:
            field_dict["amount"] = amount
        if client is not UNSET:
            field_dict["client"] = client
        if created_at is not UNSET:
            field_dict["created_at"] = created_at
        if deleted_at is not UNSET:
            field_dict["deleted_at"] = deleted_at
        if employee is not UNSET:
            field_dict["employee"] = employee
        if first_name is not UNSET:
            field_dict["first_name"] = first_name
        if last_name is not UNSET:
            field_dict["last_name"] = last_name
        if plan is not UNSET:
            field_dict["plan"] = plan
        if processed_at is not UNSET:
            field_dict["processed_at"] = processed_at
        if processor is not UNSET:
            field_dict["processor"] = processor
        if reason is not UNSET:
            field_dict["reason"] = reason
        if requested_at is not UNSET:
            field_dict["requested_at"] = requested_at
        if source is not UNSET:
            field_dict["source"] = source
        if source_id is not UNSET:
            field_dict["source_id"] = source_id
        if ssn is not UNSET:
            field_dict["ssn"] = ssn
        if status is not UNSET:
            field_dict["status"] = status
        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:
        d = dict(src_dict)
        field_id = d.pop("_id", UNSET)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        types_distribution = cls(
            field_id=field_id,
            amount=amount,
            client=client,
            created_at=created_at,
            deleted_at=deleted_at,
            employee=employee,
            first_name=first_name,
            last_name=last_name,
            plan=plan,
            processed_at=processed_at,
            processor=processor,
            reason=reason,
            requested_at=requested_at,
            source=source,
            source_id=source_id,
            ssn=ssn,
            status=status,
            team=team,
        )

        types_distribution.additional_properties = d
        return types_distribution

    @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
