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


@_attrs_define
class PkgRoutesPackagesRetirementFormatsExportCensusRequest:
    """
    Attributes:
        client (str | Unset):
        format_ (str | Unset):
        plan (str | Unset):
        py (int | Unset):
        show_zero_comp (bool | Unset):
        upload_to_provider (bool | Unset):
    """

    client: str | Unset = UNSET
    format_: str | Unset = UNSET
    plan: str | Unset = UNSET
    py: int | Unset = UNSET
    show_zero_comp: bool | Unset = UNSET
    upload_to_provider: bool | Unset = UNSET
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        format_ = self.format_

        plan = self.plan

        py = self.py

        show_zero_comp = self.show_zero_comp

        upload_to_provider = self.upload_to_provider

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if client is not UNSET:
            field_dict["client"] = client
        if format_ is not UNSET:
            field_dict["format"] = format_
        if plan is not UNSET:
            field_dict["plan"] = plan
        if py is not UNSET:
            field_dict["py"] = py
        if show_zero_comp is not UNSET:
            field_dict["show_zero_comp"] = show_zero_comp
        if upload_to_provider is not UNSET:
            field_dict["upload_to_provider"] = upload_to_provider

        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)

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

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

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

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

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

        pkg_routes_packages_retirement_formats_export_census_request = cls(
            client=client,
            format_=format_,
            plan=plan,
            py=py,
            show_zero_comp=show_zero_comp,
            upload_to_provider=upload_to_provider,
        )

        pkg_routes_packages_retirement_formats_export_census_request.additional_properties = d
        return pkg_routes_packages_retirement_formats_export_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
