# 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

class UsersCreateRequest(BaseModel):
    """
    UsersCreateRequest
    """
    birthday: Optional[Any] = Field(None, description="The birthday of the user.")
    email: Optional[Any] = Field(..., description="The primary verified email address of the user.")
    full_name: Optional[Any] = Field(None, alias="fullName", description="The user's full name. Some plans require the user name to be present when creating a subscription. Check the plan requirements for that.")
    preferred_locale: Optional[Any] = Field(None, alias="preferredLocale", description="The user's locale preference represented as an [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag). It defaults to the project's preferred locale.")
    __properties = ["birthday", "email", "fullName", "preferredLocale"]

    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) -> UsersCreateRequest:
        """Create an instance of UsersCreateRequest 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 birthday (nullable) is None
        # and __fields_set__ contains the field
        if self.birthday is None and "birthday" in self.__fields_set__:
            _dict['birthday'] = None

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

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

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

        return _dict

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

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

        _obj = UsersCreateRequest.parse_obj({
            "birthday": obj.get("birthday"),
            "email": obj.get("email"),
            "full_name": obj.get("fullName"),
            "preferred_locale": obj.get("preferredLocale")
        })
        return _obj

