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


@_attrs_define
class PkgRoutesCpCensusUploadCensusRequest:
    """
    Attributes:
        client (str | Unset):
        name (str | Unset):
        py (int | Unset):
        size (int | Unset):
        task (str | Unset):
        type_ (str | Unset):
    """

    client: str | Unset = UNSET
    name: str | Unset = UNSET
    py: int | Unset = UNSET
    size: int | Unset = UNSET
    task: str | Unset = UNSET
    type_: str | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        name = self.name

        py = self.py

        size = self.size

        task = self.task

        type_ = self.type_

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if client is not UNSET:
            field_dict["client"] = client
        if name is not UNSET:
            field_dict["name"] = name
        if py is not UNSET:
            field_dict["py"] = py
        if size is not UNSET:
            field_dict["size"] = size
        if task is not UNSET:
            field_dict["task"] = task
        if type_ is not UNSET:
            field_dict["type"] = type_

        return field_dict

    @classmethod
    def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
        d = dict(src_dict)
        client = d.pop("client", UNSET)

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

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

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

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

        type_ = d.pop("type", UNSET)

        pkg_routes_cp_census_upload_census_request = cls(
            client=client,
            name=name,
            py=py,
            size=size,
            task=task,
            type_=type_,
        )

        pkg_routes_cp_census_upload_census_request.additional_properties = d
        return pkg_routes_cp_census_upload_census_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
