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

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

from ..types import UNSET, Unset

if TYPE_CHECKING:
    from ..models.v1_alpha_sequence import V1AlphaSequence


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


@_attrs_define
class V1AlphaListSequencesResponse:
    """ListSequencesResponse is the response message for ListSequences.

    Attributes:
        sequences (Union[Unset, List['V1AlphaSequence']]): A list of Sequences.
        next_page_token (Union[Unset, str]): Next page token is the token to use to retrieve the next page of results.
    """

    sequences: Union[Unset, List["V1AlphaSequence"]] = UNSET
    next_page_token: Union[Unset, str] = UNSET
    additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)

    def to_dict(self) -> Dict[str, Any]:
        sequences: Union[Unset, List[Dict[str, Any]]] = UNSET
        if not isinstance(self.sequences, Unset):
            sequences = []
            for sequences_item_data in self.sequences:
                sequences_item = sequences_item_data.to_dict()
                sequences.append(sequences_item)

        next_page_token = self.next_page_token

        field_dict: Dict[str, Any] = {}
        field_dict.update(self.additional_properties)
        field_dict.update({})
        if sequences is not UNSET:
            field_dict["sequences"] = sequences
        if next_page_token is not UNSET:
            field_dict["nextPageToken"] = next_page_token

        return field_dict

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

        d = src_dict.copy()
        sequences = []
        _sequences = d.pop("sequences", UNSET)
        for sequences_item_data in _sequences or []:
            sequences_item = V1AlphaSequence.from_dict(sequences_item_data)

            sequences.append(sequences_item)

        next_page_token = d.pop("nextPageToken", UNSET)

        v1_alpha_list_sequences_response = cls(
            sequences=sequences,
            next_page_token=next_page_token,
        )

        v1_alpha_list_sequences_response.additional_properties = d
        return v1_alpha_list_sequences_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
