# coding: utf-8

"""
    Gigs Core API

    API to manage voice & data plans for smartphones, wearables and IoT in 200+ countries.  # noqa: E501

    The version of the OpenAPI document: 0.0.1
    Contact: support@gigs.com
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""


from __future__ import annotations
import pprint
import re  # noqa: F401
import json


from typing import Any, Optional
from pydantic import BaseModel, Field, validator

class PlanRequirements(BaseModel):
    """
    PlanRequirements
    """
    address: Optional[Any] = Field(..., description="The address requirements that must be fulfilled before a user may purchase a subscription.")
    device: Optional[Any] = Field(..., description="The device requirements that must be fulfilled before a user may purchase a subscription.")
    user_birthday: Optional[Any] = Field(..., alias="user.birthday", description="The user birthday requirements that must be fulfilled before a user may purchase a subscription.")
    user_full_name: Optional[Any] = Field(..., alias="user.fullName", description="The user full name requirements that must be fulfilled before a user may purchase a subscription.")
    __properties = ["address", "device", "user.birthday", "user.fullName"]

    @validator('address')
    def address_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in ('none', 'present', 'verified'):
            raise ValueError("must be one of enum values ('none', 'present', 'verified')")
        return value

    @validator('device')
    def device_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in ('none', 'present', 'verified'):
            raise ValueError("must be one of enum values ('none', 'present', 'verified')")
        return value

    @validator('user_birthday')
    def user_birthday_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in ('none', 'present', 'verified'):
            raise ValueError("must be one of enum values ('none', 'present', 'verified')")
        return value

    @validator('user_full_name')
    def user_full_name_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in ('none', 'present', 'verified'):
            raise ValueError("must be one of enum values ('none', 'present', 'verified')")
        return value

    class Config:
        """Pydantic configuration"""
        allow_population_by_field_name = True
        validate_assignment = True

    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.dict(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> PlanRequirements:
        """Create an instance of PlanRequirements from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True,
                          exclude={
                          },
                          exclude_none=True)
        # set to None if address (nullable) is None
        # and __fields_set__ contains the field
        if self.address is None and "address" in self.__fields_set__:
            _dict['address'] = None

        # set to None if device (nullable) is None
        # and __fields_set__ contains the field
        if self.device is None and "device" in self.__fields_set__:
            _dict['device'] = None

        # set to None if user_birthday (nullable) is None
        # and __fields_set__ contains the field
        if self.user_birthday is None and "user_birthday" in self.__fields_set__:
            _dict['user.birthday'] = None

        # set to None if user_full_name (nullable) is None
        # and __fields_set__ contains the field
        if self.user_full_name is None and "user_full_name" in self.__fields_set__:
            _dict['user.fullName'] = None

        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> PlanRequirements:
        """Create an instance of PlanRequirements from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return PlanRequirements.parse_obj(obj)

        _obj = PlanRequirements.parse_obj({
            "address": obj.get("address"),
            "device": obj.get("device"),
            "user_birthday": obj.get("user.birthday"),
            "user_full_name": obj.get("user.fullName")
        })
        return _obj

