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

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


@_attrs_define
class GenerateAnnotationsResponse:
    """Response for generate annotations endpoint (202 Accepted).

    Returns the accepted doc and tag IDs that will be processed.

        Attributes:
            doc_ext_ids (list[str]): Document IDs that will be processed
            tag_ext_ids (list[str]): Tag IDs that will be processed
    """

    doc_ext_ids: list[str]
    tag_ext_ids: list[str]
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        tag_ext_ids = self.tag_ext_ids

        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update(
            {
                "doc_ext_ids": doc_ext_ids,
                "tag_ext_ids": tag_ext_ids,
            }
        )

        return field_dict

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

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

        generate_annotations_response = cls(
            doc_ext_ids=doc_ext_ids,
            tag_ext_ids=tag_ext_ids,
        )

        generate_annotations_response.additional_properties = d
        return generate_annotations_response

    @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
