# 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 ProjectLegal(BaseModel):
    """
    The legal address for the company that manages the project.
    """
    name: Optional[Any] = Field(..., description="The company's legal name.")
    city: Optional[Any] = Field(..., description="The city/municipality of the company's legal address.")
    country: Optional[Any] = Field(..., description="The ISO 3166-1 alpha-2 country code for the company's legal address.")
    line1: Optional[Any] = Field(..., description="The first line of the company's legal address, e.g. street and house number.")
    line2: Optional[Any] = Field(..., description="The second line of the given street address, e.g. Apartment number.")
    postal_code: Optional[Any] = Field(..., alias="postalCode", description="The postal code of the given street address.")
    state: Optional[Any] = Field(..., description="The state/province/region of the given street address.")
    __properties = ["name", "city", "country", "line1", "line2", "postalCode", "state"]

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = ProjectLegal.parse_obj({
            "name": obj.get("name"),
            "city": obj.get("city"),
            "country": obj.get("country"),
            "line1": obj.get("line1"),
            "line2": obj.get("line2"),
            "postal_code": obj.get("postalCode"),
            "state": obj.get("state")
        })
        return _obj

