# coding: utf-8

"""
    CampaignManagementService

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 1.0.0
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


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

from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union, Set
from typing_extensions import Self

class Address(BaseModel):
    """
    Address
    """ # noqa: E501
    street_address: Optional[StrictStr] = Field(default=None, alias="StreetAddress")
    street_address2: Optional[StrictStr] = Field(default=None, alias="StreetAddress2")
    city_name: Optional[StrictStr] = Field(default=None, alias="CityName")
    province_code: Optional[StrictStr] = Field(default=None, alias="ProvinceCode")
    province_name: Optional[StrictStr] = Field(default=None, alias="ProvinceName")
    postal_code: Optional[StrictStr] = Field(default=None, alias="PostalCode")
    country_code: Optional[StrictStr] = Field(default=None, alias="CountryCode")
    __properties: ClassVar[List[str]] = ["StreetAddress", "StreetAddress2", "CityName", "ProvinceCode", "ProvinceName", "PostalCode", "CountryCode"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )
	

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # set to None if street_address (nullable) is None
        # and model_fields_set contains the field
        if self.street_address is None and "street_address" in self.model_fields_set:
            _dict['StreetAddress'] = None

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

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

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

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

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

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

        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of Address from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "StreetAddress": obj.get("StreetAddress") if obj.get("StreetAddress") is not None else None,
                        "StreetAddress2": obj.get("StreetAddress2") if obj.get("StreetAddress2") is not None else None,
                        "CityName": obj.get("CityName") if obj.get("CityName") is not None else None,
                        "ProvinceCode": obj.get("ProvinceCode") if obj.get("ProvinceCode") is not None else None,
                        "ProvinceName": obj.get("ProvinceName") if obj.get("ProvinceName") is not None else None,
                        "PostalCode": obj.get("PostalCode") if obj.get("PostalCode") is not None else None,
                        "CountryCode": obj.get("CountryCode") if obj.get("CountryCode") is not None else None
        })
        return _obj
