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 ..models.text_to_company_search_params_response_200_output_search_params_accelerators_v2_type_0_any_of_type_0_item_batch_selection_type_1_strategy import (
    TextToCompanySearchParamsResponse200OutputSearchParamsAcceleratorsV2Type0AnyOfType0ItemBatchSelectionType1Strategy,
)

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


@_attrs_define
class TextToCompanySearchParamsResponse200OutputSearchParamsAcceleratorsV2Type0AnyOfType0ItemBatchSelectionType1:
    """
    Attributes:
        strategy (TextToCompanySearchParamsResponse200OutputSearchParamsAcceleratorsV2Type0AnyOfType0ItemBatchSelectionT
            ype1Strategy):
        batches (list[str]):
    """

    strategy: TextToCompanySearchParamsResponse200OutputSearchParamsAcceleratorsV2Type0AnyOfType0ItemBatchSelectionType1Strategy
    batches: list[str]
    additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

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

        batches = self.batches

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

        return field_dict

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

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

        text_to_company_search_params_response_200_output_search_params_accelerators_v2_type_0_any_of_type_0_item_batch_selection_type_1 = cls(
            strategy=strategy,
            batches=batches,
        )

        text_to_company_search_params_response_200_output_search_params_accelerators_v2_type_0_any_of_type_0_item_batch_selection_type_1.additional_properties = d
        return text_to_company_search_params_response_200_output_search_params_accelerators_v2_type_0_any_of_type_0_item_batch_selection_type_1

    @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
