from __future__ import annotations

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

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

from ..types import UNSET, Unset

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


@_attrs_define
class LegacytypesComplianceSubmission:
    """
    Attributes:
        field_id (str | Unset):
        ack_id (str | Unset):
        client (str | Unset):
        deleted_at (str | Unset):
        errors (list[str] | Unset):
        file_id (str | Unset):
        filing_id (str | Unset):
        plan (str | Unset):
        raw_request (Any | Unset):
        raw_xml (str | Unset):
        received_at (str | Unset):
        request_id (str | Unset):
        status (str | Unset):
        submitted_at (str | Unset):
        submitted_by (str | Unset):
        team (str | Unset):
        type_ (str | Unset):
        updated_at (str | Unset):
        warnings (list[str] | Unset):
        year (int | Unset):
    """

    field_id: str | Unset = UNSET
    ack_id: str | Unset = UNSET
    client: str | Unset = UNSET
    deleted_at: str | Unset = UNSET
    errors: list[str] | Unset = UNSET
    file_id: str | Unset = UNSET
    filing_id: str | Unset = UNSET
    plan: str | Unset = UNSET
    raw_request: Any | Unset = UNSET
    raw_xml: str | Unset = UNSET
    received_at: str | Unset = UNSET
    request_id: str | Unset = UNSET
    status: str | Unset = UNSET
    submitted_at: str | Unset = UNSET
    submitted_by: str | Unset = UNSET
    team: str | Unset = UNSET
    type_: str | Unset = UNSET
    updated_at: str | Unset = UNSET
    warnings: list[str] | Unset = UNSET
    year: 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

        ack_id = self.ack_id

        client = self.client

        deleted_at = self.deleted_at

        errors: list[str] | Unset = UNSET
        if not isinstance(self.errors, Unset):
            errors = self.errors

        file_id = self.file_id

        filing_id = self.filing_id

        plan = self.plan

        raw_request = self.raw_request

        raw_xml = self.raw_xml

        received_at = self.received_at

        request_id = self.request_id

        status = self.status

        submitted_at = self.submitted_at

        submitted_by = self.submitted_by

        team = self.team

        type_ = self.type_

        updated_at = self.updated_at

        warnings: list[str] | Unset = UNSET
        if not isinstance(self.warnings, Unset):
            warnings = self.warnings

        year = self.year

        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 ack_id is not UNSET:
            field_dict["ack_id"] = ack_id
        if client is not UNSET:
            field_dict["client"] = client
        if deleted_at is not UNSET:
            field_dict["deleted_at"] = deleted_at
        if errors is not UNSET:
            field_dict["errors"] = errors
        if file_id is not UNSET:
            field_dict["file_id"] = file_id
        if filing_id is not UNSET:
            field_dict["filing_id"] = filing_id
        if plan is not UNSET:
            field_dict["plan"] = plan
        if raw_request is not UNSET:
            field_dict["raw_request"] = raw_request
        if raw_xml is not UNSET:
            field_dict["raw_xml"] = raw_xml
        if received_at is not UNSET:
            field_dict["received_at"] = received_at
        if request_id is not UNSET:
            field_dict["request_id"] = request_id
        if status is not UNSET:
            field_dict["status"] = status
        if submitted_at is not UNSET:
            field_dict["submitted_at"] = submitted_at
        if submitted_by is not UNSET:
            field_dict["submitted_by"] = submitted_by
        if team is not UNSET:
            field_dict["team"] = team
        if type_ is not UNSET:
            field_dict["type"] = type_
        if updated_at is not UNSET:
            field_dict["updated_at"] = updated_at
        if warnings is not UNSET:
            field_dict["warnings"] = warnings
        if year is not UNSET:
            field_dict["year"] = year

        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)

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

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

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

        errors = cast(list[str], d.pop("errors", UNSET))

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

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

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

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

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

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

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

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

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

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

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

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

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

        warnings = cast(list[str], d.pop("warnings", UNSET))

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

        legacytypes_compliance_submission = cls(
            field_id=field_id,
            ack_id=ack_id,
            client=client,
            deleted_at=deleted_at,
            errors=errors,
            file_id=file_id,
            filing_id=filing_id,
            plan=plan,
            raw_request=raw_request,
            raw_xml=raw_xml,
            received_at=received_at,
            request_id=request_id,
            status=status,
            submitted_at=submitted_at,
            submitted_by=submitted_by,
            team=team,
            type_=type_,
            updated_at=updated_at,
            warnings=warnings,
            year=year,
        )

        legacytypes_compliance_submission.additional_properties = d
        return legacytypes_compliance_submission

    @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
