from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar

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

if TYPE_CHECKING:
    from ..models.v1_alpha_create_sequence_request import V1AlphaCreateSequenceRequest


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


@_attrs_define
class SeqqServiceBatchCreateSequencesBody:
    """BatchCreateSequencesRequest specifies how to create a batch of sequences at once.
    Sequences in requests that already exist are ignored and not returned in the response.

        Attributes:
            requests (List['V1AlphaCreateSequenceRequest']): The request message specifying the sequences to create. The
                maximum length is 100.
    """

    requests: List["V1AlphaCreateSequenceRequest"]
    additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)

    def to_dict(self) -> Dict[str, Any]:
        requests = []
        for requests_item_data in self.requests:
            requests_item = requests_item_data.to_dict()
            requests.append(requests_item)

        field_dict: Dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update(
            {
                "requests": requests,
            }
        )

        return field_dict

    @classmethod
    def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
        from ..models.v1_alpha_create_sequence_request import V1AlphaCreateSequenceRequest

        d = src_dict.copy()
        requests = []
        _requests = d.pop("requests")
        for requests_item_data in _requests:
            requests_item = V1AlphaCreateSequenceRequest.from_dict(requests_item_data)

            requests.append(requests_item)

        seqq_service_batch_create_sequences_body = cls(
            requests=requests,
        )

        seqq_service_batch_create_sequences_body.additional_properties = d
        return seqq_service_batch_create_sequences_body

    @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
