# coding: utf-8

"""
    FreeClimb API

    FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site telephony equipment. Using the FreeClimb REST API to write applications is easy! You have the option to use the language of your choice or hit the API directly. Your application can execute a command by issuing a RESTful request to the FreeClimb API. The base URL to send HTTP requests to the FreeClimb REST API is: /apiserver. FreeClimb authenticates and processes your request.

    The version of the OpenAPI document: 1.0.0
    Contact: support@freeclimb.com
    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, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated
from freeclimb.models.sms_ten_dlc_brand_alt_business_id_type import (
    SMSTenDLCBrandAltBusinessIdType,
)
from freeclimb.models.sms_ten_dlc_brand_entity_type import SMSTenDLCBrandEntityType
from freeclimb.models.sms_ten_dlc_brand_identity_status import (
    SMSTenDLCBrandIdentityStatus,
)
from freeclimb.models.sms_ten_dlc_brand_relationship import SMSTenDLCBrandRelationship
from freeclimb.models.sms_ten_dlc_brand_stock_exchange import (
    SMSTenDLCBrandStockExchange,
)
from pydantic import StrictStr
from typing import Optional, Set
from typing_extensions import Self


class SMSTenDLCBrand(
    BaseModel, populate_by_name=True, validate_assignment=True, protected_namespaces=()
):
    """
    A brand is a business identity behind the campaign.
    """  # noqa: E501

    account_id: Optional[StrictStr] = Field(
        default=None,
        description="ID of the account that created this Queue.",
        alias="accountId",
    )
    entity_type: SMSTenDLCBrandEntityType = Field(alias="entityType")
    csp_id: Optional[StrictStr] = Field(
        default=None,
        description="Unique identifier assigned to the csp by the registry.",
        alias="cspId",
    )
    brand_id: Optional[StrictStr] = Field(
        default=None,
        description="Unique identifier assigned to the brand by the registry.",
        alias="brandId",
    )
    first_name: Optional[Annotated[str, Field(strict=True, max_length=100)]] = Field(
        default=None, description="First or given name. ", alias="firstName"
    )
    last_name: Optional[Annotated[str, Field(strict=True, max_length=100)]] = Field(
        default=None, description="Last or Surname.", alias="lastName"
    )
    display_name: Annotated[str, Field(strict=True, max_length=255)] = Field(
        description="Display or marketing name of the brand.", alias="displayName"
    )
    company_name: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field(
        default=None,
        description="(Required for Non-profit/private/public) Legal company name.",
        alias="companyName",
    )
    ein: Optional[Annotated[str, Field(strict=True, max_length=21)]] = Field(
        default=None,
        description="(Required for Non-profit) Government assigned corporate tax ID. EIN is 9-digits in U.S.",
    )
    ein_issuing_country: Optional[Annotated[str, Field(strict=True, max_length=2)]] = (
        Field(
            default=None,
            description="ISO2 2 characters country code. Example: US - United States",
            alias="einIssuingCountry",
        )
    )
    phone: Annotated[str, Field(strict=True, max_length=20)] = Field(
        description="Valid phone number in e.164 international format."
    )
    street: Optional[Annotated[str, Field(strict=True, max_length=100)]] = Field(
        default=None, description="Street number and name."
    )
    city: Optional[Annotated[str, Field(strict=True, max_length=100)]] = Field(
        default=None, description="City name"
    )
    state: Optional[Annotated[str, Field(strict=True, max_length=20)]] = Field(
        default=None, description="State. Must be 2 letters code for United States."
    )
    postal_code: Optional[Annotated[str, Field(strict=True, max_length=10)]] = Field(
        default=None,
        description="Postal codes. Use 5 digit zipcode for United States",
        alias="postalCode",
    )
    country: Annotated[str, Field(strict=True, max_length=2)] = Field(
        description="ISO2 2 characters country code. Example: US - United States"
    )
    email: Annotated[str, Field(strict=True, max_length=100)] = Field(
        description="Valid email address of brand support contact."
    )
    stock_symbol: Optional[Annotated[str, Field(strict=True, max_length=10)]] = Field(
        default=None,
        description="(Required for public company) stock symbol.",
        alias="stockSymbol",
    )
    stock_exchange: Optional[SMSTenDLCBrandStockExchange] = Field(
        default=None, alias="stockExchange"
    )
    ip_address: Optional[Annotated[str, Field(strict=True, max_length=50)]] = Field(
        default=None,
        description="IP address of the browser requesting to create brand identity.",
        alias="ipAddress",
    )
    website: Optional[Annotated[str, Field(strict=True, max_length=100)]] = Field(
        default=None, description="Brand website URL."
    )
    brand_relationship: SMSTenDLCBrandRelationship = Field(alias="brandRelationship")
    vertical: Annotated[str, Field(strict=True, max_length=50)] = Field(
        description="Vertical or industry segment of the brand."
    )
    alt_business_id: Optional[Annotated[str, Field(strict=True, max_length=50)]] = (
        Field(
            default=None,
            description="Alternate business identifier such as DUNS, LEI, or GIIN",
            alias="altBusinessId",
        )
    )
    alt_business_id_type: Optional[SMSTenDLCBrandAltBusinessIdType] = Field(
        default=None, alias="altBusinessIdType"
    )
    universal_ein: Optional[StrictStr] = Field(
        default=None,
        description="Universal EIN of Brand, Read Only.",
        alias="universalEin",
    )
    reference_id: Optional[Annotated[str, Field(strict=True, max_length=50)]] = Field(
        default=None,
        description="Caller supplied brand reference ID. If supplied, the value must be unique across all submitted brands. Can be used to prevent duplicate brand registrations.",
        alias="referenceId",
    )
    optional_attributes: Optional[Dict[str, Any]] = Field(
        default=None,
        description="Optional brand attributes. Please refer to GET /enum/optionalAttributeNames for dictionary of optional attribute names.",
        alias="optionalAttributes",
    )
    mock: StrictBool = Field(description="Test brand.")
    identity_status: SMSTenDLCBrandIdentityStatus = Field(alias="identityStatus")
    create_date: Optional[datetime] = Field(
        default=None,
        description="Unix timestamp when brand was created.",
        alias="createDate",
    )

    __properties: ClassVar[List[str]] = [
        "accountId",
        "entityType",
        "cspId",
        "brandId",
        "firstName",
        "lastName",
        "displayName",
        "companyName",
        "ein",
        "einIssuingCountry",
        "phone",
        "street",
        "city",
        "state",
        "postalCode",
        "country",
        "email",
        "stockSymbol",
        "stockExchange",
        "ipAddress",
        "website",
        "brandRelationship",
        "vertical",
        "altBusinessId",
        "altBusinessIdType",
        "universalEin",
        "referenceId",
        "optionalAttributes",
        "mock",
        "identityStatus",
        "createDate",
    ]

    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of SMSTenDLCBrand from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    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.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        * OpenAPI `readOnly` fields are excluded.
        """
        excluded_fields: Set[str] = set(
            [
                "csp_id",
                "brand_id",
                "universal_ein",
            ]
        )

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

        return _dict

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

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

        _obj = cls.model_validate(
            {
                "accountId": obj.get("accountId"),
                "entityType": obj.get("entityType"),
                "cspId": obj.get("cspId"),
                "brandId": obj.get("brandId"),
                "firstName": obj.get("firstName"),
                "lastName": obj.get("lastName"),
                "displayName": obj.get("displayName"),
                "companyName": obj.get("companyName"),
                "ein": obj.get("ein"),
                "einIssuingCountry": obj.get("einIssuingCountry"),
                "phone": obj.get("phone"),
                "street": obj.get("street"),
                "city": obj.get("city"),
                "state": obj.get("state"),
                "postalCode": obj.get("postalCode"),
                "country": obj.get("country"),
                "email": obj.get("email"),
                "stockSymbol": obj.get("stockSymbol"),
                "stockExchange": obj.get("stockExchange"),
                "ipAddress": obj.get("ipAddress"),
                "website": obj.get("website"),
                "brandRelationship": obj.get("brandRelationship"),
                "vertical": obj.get("vertical"),
                "altBusinessId": obj.get("altBusinessId"),
                "altBusinessIdType": obj.get("altBusinessIdType"),
                "universalEin": obj.get("universalEin"),
                "referenceId": obj.get("referenceId"),
                "optionalAttributes": obj.get("optionalAttributes"),
                "mock": obj.get("mock"),
                "identityStatus": obj.get("identityStatus"),
                "createDate": obj.get("createDate"),
            }
        )
        return _obj
