# 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 SimCredentials(BaseModel):
    """
    SimCredentials
    """
    object: Optional[Any] = Field(..., description="Type of object is always `simCredentials`.")
    activation_code: Optional[Any] = Field(..., alias="activationCode", description="eSIM activation code to download and install the profile in a device. Only available for type `eSIM`.")
    qr_code_url: Optional[Any] = Field(..., alias="qrCodeUrl", description="URL of the activation code in QR-Code format. Only available for type `eSIM`.  <!-- theme: warning -->  > Be careful how you share this URL, it can be accessed publicly without authentication.")
    sim: Optional[Any] = Field(..., description="Unique identifier for the SIM this credentials are for.")
    __properties = ["object", "activationCode", "qrCodeUrl", "sim"]

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

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

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

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

        return _dict

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

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

        _obj = SimCredentials.parse_obj({
            "object": obj.get("object"),
            "activation_code": obj.get("activationCode"),
            "qr_code_url": obj.get("qrCodeUrl"),
            "sim": obj.get("sim")
        })
        return _obj

