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="PkgRoutesCpClientRequest")


@_attrs_define
class PkgRoutesCpClientRequest:
    """
    Attributes:
        field_id (str | Unset):
        completed_at (str | Unset):
        created_at (str | Unset):
        incomplete_tasks (int | Unset):
        lead (str | Unset):
        plan (str | Unset):
        title (str | Unset):
        total_tasks (int | Unset):
    """

    field_id: str | Unset = UNSET
    completed_at: str | Unset = UNSET
    created_at: str | Unset = UNSET
    incomplete_tasks: int | Unset = UNSET
    lead: str | Unset = UNSET
    plan: str | Unset = UNSET
    title: str | Unset = UNSET
    total_tasks: int | 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

        completed_at = self.completed_at

        created_at = self.created_at

        incomplete_tasks = self.incomplete_tasks

        lead = self.lead

        plan = self.plan

        title = self.title

        total_tasks = self.total_tasks

        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 completed_at is not UNSET:
            field_dict["completed_at"] = completed_at
        if created_at is not UNSET:
            field_dict["created_at"] = created_at
        if incomplete_tasks is not UNSET:
            field_dict["incomplete_tasks"] = incomplete_tasks
        if lead is not UNSET:
            field_dict["lead"] = lead
        if plan is not UNSET:
            field_dict["plan"] = plan
        if title is not UNSET:
            field_dict["title"] = title
        if total_tasks is not UNSET:
            field_dict["total_tasks"] = total_tasks

        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)

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

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

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

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

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

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

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

        pkg_routes_cp_client_request = cls(
            field_id=field_id,
            completed_at=completed_at,
            created_at=created_at,
            incomplete_tasks=incomplete_tasks,
            lead=lead,
            plan=plan,
            title=title,
            total_tasks=total_tasks,
        )

        pkg_routes_cp_client_request.additional_properties = d
        return pkg_routes_cp_client_request

    @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
