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

import attr

from ..types import UNSET, Unset

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


@attr.s(auto_attribs=True)
class Contact:
    """ """

    type: "str"
    verified: "Union[Unset, bool]" = UNSET

    def to_dict(self) -> Dict[str, Any]:
        type = self.type
        verified = self.verified

        field_dict: Dict[str, Any] = {}
        field_dict.update(
            {
                "type": type,
            }
        )
        if verified is not UNSET:
            field_dict["verified"] = verified

        return field_dict

    @classmethod
    def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:

        d = src_dict.copy()

        type = d.pop("type")

        verified = d.pop("verified", UNSET)

        contact = cls(
            type=type,
            verified=verified,
        )

        return contact
