# 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 PortingsCreateRequest(BaseModel):
    """
    PortingsCreateRequest
    """
    account_number: Optional[Any] = Field(None, alias="accountNumber", description="The account number on the donor service provider.")
    account_pin: Optional[Any] = Field(None, alias="accountPin", description="The pin for the account on the donor service provider. This will be used only for the porting.")
    birthday: Optional[Any] = Field(None, description="The birthday of the account holder on the donor service provider.")
    donor_provider: Optional[Any] = Field(None, alias="donorProvider", description="The unique identifier of the donor service provider.")
    first_name: Optional[Any] = Field(None, alias="firstName", description="The first name of the account holder.")
    last_name: Optional[Any] = Field(None, alias="lastName", description="The last name of the account holder.")
    phone_number: Optional[Any] = Field(..., alias="phoneNumber", description="The phone number to port in E.164 format.")
    provider: Optional[Any] = Field(..., description="The name of the receiving network provider.")
    user: Optional[Any] = Field(..., description="The unique identifier for an existing [user](https://developers.gigs.com/docs/api/b3A6MzMwODcxNDM-retrieve-a-user) the porting should be created for.")
    __properties = ["accountNumber", "accountPin", "birthday", "donorProvider", "firstName", "lastName", "phoneNumber", "provider", "user"]

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

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

        # 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 donor_provider (nullable) is None
        # and __fields_set__ contains the field
        if self.donor_provider is None and "donor_provider" in self.__fields_set__:
            _dict['donorProvider'] = None

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

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

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

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

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

        return _dict

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

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

        _obj = PortingsCreateRequest.parse_obj({
            "account_number": obj.get("accountNumber"),
            "account_pin": obj.get("accountPin"),
            "birthday": obj.get("birthday"),
            "donor_provider": obj.get("donorProvider"),
            "first_name": obj.get("firstName"),
            "last_name": obj.get("lastName"),
            "phone_number": obj.get("phoneNumber"),
            "provider": obj.get("provider"),
            "user": obj.get("user")
        })
        return _obj

