from __future__ import annotations

from collections.abc import Mapping
from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator

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

from ..types import UNSET, Unset

from ..types import UNSET, Unset
from typing import cast
from typing import Literal, cast






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



@_attrs_define
class GetTableOfContentsDetail:
    """ Detail for a get_table_of_contents tool call.

        Attributes:
            doc_count (int): Number of documents requested
            doc_ext_ids (list[str]): Document external IDs
            tool (Literal['get_table_of_contents'] | Unset):  Default: 'get_table_of_contents'.
     """

    doc_count: int
    doc_ext_ids: list[str]
    tool: Literal['get_table_of_contents'] | Unset = 'get_table_of_contents'
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)





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

        doc_ext_ids = self.doc_ext_ids



        tool = self.tool


        field_dict: dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({
            "doc_count": doc_count,
            "doc_ext_ids": doc_ext_ids,
        })
        if tool is not UNSET:
            field_dict["tool"] = tool

        return field_dict



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

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


        tool = cast(Literal['get_table_of_contents'] | Unset , d.pop("tool", UNSET))
        if tool != 'get_table_of_contents'and not isinstance(tool, Unset):
            raise ValueError(f"tool must match const 'get_table_of_contents', got '{tool}'")

        get_table_of_contents_detail = cls(
            doc_count=doc_count,
            doc_ext_ids=doc_ext_ids,
            tool=tool,
        )


        get_table_of_contents_detail.additional_properties = d
        return get_table_of_contents_detail

    @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
