# 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_partner_campaign_brand import (
    SMSTenDLCPartnerCampaignBrand,
)
from freeclimb.models.sms_ten_dlc_partner_campaign_status import (
    SMSTenDLCPartnerCampaignStatus,
)
from pydantic import StrictStr
from typing import Optional, Set
from typing_extensions import Self


class SMSTenDLCPartnerCampaign(
    BaseModel, populate_by_name=True, validate_assignment=True, protected_namespaces=()
):
    """
    SMSTenDLCPartnerCampaign
    """  # noqa: E501

    account_id: Optional[StrictStr] = Field(
        default=None,
        description="ID of the account that created this Queue.",
        alias="accountId",
    )
    campaign_id: StrictStr = Field(
        description="Alphanumeric identifier assigned by the registry for a campaign. This identifier is required by the NetNumber OSR SMS enabling process of 10DLC.",
        alias="campaignId",
    )
    status: Optional[SMSTenDLCPartnerCampaignStatus] = None
    create_date: Optional[datetime] = Field(
        default=None,
        description="Unix timestamp when campaign was created.",
        alias="createDate",
    )
    brand_id: Annotated[str, Field(strict=True, max_length=8)] = Field(
        description="Alphanumeric identifier of the brand associated with this campaign.",
        alias="brandId",
    )
    usecase: Annotated[str, Field(strict=True, max_length=20)] = Field(
        description="Campaign usecase. Must be of defined valid types. Use `/registry/enum/usecase` operation to retrieve usecases available for given brand."
    )
    description: Annotated[str, Field(strict=True, max_length=4096)] = Field(
        description="Summary description of this campaign."
    )
    embedded_link: Optional[StrictBool] = Field(
        default=False,
        description="Does message generated by the campaign include URL link in SMS?",
        alias="embeddedLink",
    )
    embedded_phone: Optional[StrictBool] = Field(
        default=False,
        description="Does message generated by the campaign include phone number in SMS?",
        alias="embeddedPhone",
    )
    affiliate_marketing: Optional[StrictBool] = Field(
        default=None,
        description="Does message content controlled by affiliate marketing other than the brand?",
        alias="affiliateMarketing",
    )
    number_pool: Optional[StrictBool] = Field(
        default=False,
        description="Does campaign utilize pool of phone nubers?",
        alias="numberPool",
    )
    age_gated: Optional[StrictBool] = Field(
        default=None, description="Age gated content in campaign.", alias="ageGated"
    )
    direct_lending: Optional[StrictBool] = Field(default=None, alias="directLending")
    subscriber_optin: Optional[StrictBool] = Field(
        default=False,
        description="Does campaign require subscriber to opt-in before SMS is sent to subscriber?",
        alias="subscriberOptin",
    )
    subscriber_optout: Optional[StrictBool] = Field(
        default=False,
        description="Does campaign support subscriber opt-out keyword(s)?",
        alias="subscriberOptout",
    )
    subscriber_help: Optional[StrictBool] = Field(
        default=False,
        description="Does campaign responds to help keyword(s)?",
        alias="subscriberHelp",
    )
    sample1: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(
        default=None,
        description="Message sample. Some campaign tiers require 1 or more message samples.",
    )
    sample2: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(
        default=None,
        description="Message sample. Some campaign tiers require 2 or more message samples.",
    )
    sample3: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(
        default=None,
        description="Message sample. Some campaign tiers require 3 or more message samples.",
    )
    sample4: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(
        default=None,
        description="Message sample. Some campaign tiers require 4 or more message samples.",
    )
    sample5: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(
        default=None,
        description="Message sample. Some campaign tiers require 5 or more message samples.",
    )
    message_flow: Optional[Annotated[str, Field(strict=True, max_length=2048)]] = Field(
        default=None, description="Message flow description.", alias="messageFlow"
    )
    help_message: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field(
        default=None, description="Help message of the campaign.", alias="helpMessage"
    )
    optin_keywords: Optional[Annotated[str, Field(strict=True, max_length=255)]] = (
        Field(
            default=None,
            description="Subscriber opt-in keywords. Multiple keywords are comma separated without space.",
            alias="optinKeywords",
        )
    )
    optout_keywords: Optional[Annotated[str, Field(strict=True, max_length=255)]] = (
        Field(
            default=None,
            description="Subscriber opt-out keywords. Multiple keywords are comma separated without space.",
            alias="optoutKeywords",
        )
    )
    help_keywords: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field(
        default=None,
        description="Subscriber help keywords. Multiple keywords are comma separated without space.",
        alias="helpKeywords",
    )
    optin_message: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field(
        default=None, description="Subscriber opt-in message.", alias="optinMessage"
    )
    optout_message: Optional[Annotated[str, Field(strict=True, max_length=255)]] = (
        Field(
            default=None,
            description="Subscriber opt-out message.",
            alias="optoutMessage",
        )
    )
    brand: Optional[SMSTenDLCPartnerCampaignBrand] = None

    __properties: ClassVar[List[str]] = [
        "accountId",
        "campaignId",
        "status",
        "createDate",
        "brandId",
        "usecase",
        "description",
        "embeddedLink",
        "embeddedPhone",
        "affiliateMarketing",
        "numberPool",
        "ageGated",
        "directLending",
        "subscriberOptin",
        "subscriberOptout",
        "subscriberHelp",
        "sample1",
        "sample2",
        "sample3",
        "sample4",
        "sample5",
        "messageFlow",
        "helpMessage",
        "optinKeywords",
        "optoutKeywords",
        "helpKeywords",
        "optinMessage",
        "optoutMessage",
        "brand",
    ]

    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 SMSTenDLCPartnerCampaign 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.
        """
        excluded_fields: Set[str] = set([])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # override the default output from pydantic by calling `to_dict()` of brand
        if self.brand:
            _dict["brand"] = self.brand.to_dict()
        # 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

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

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

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

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

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

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

        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of SMSTenDLCPartnerCampaign 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"),
                "campaignId": obj.get("campaignId"),
                "status": obj.get("status"),
                "createDate": obj.get("createDate"),
                "brandId": obj.get("brandId"),
                "usecase": obj.get("usecase"),
                "description": obj.get("description"),
                "embeddedLink": (
                    obj.get("embeddedLink")
                    if obj.get("embeddedLink") is not None
                    else False
                ),
                "embeddedPhone": (
                    obj.get("embeddedPhone")
                    if obj.get("embeddedPhone") is not None
                    else False
                ),
                "affiliateMarketing": obj.get("affiliateMarketing"),
                "numberPool": (
                    obj.get("numberPool")
                    if obj.get("numberPool") is not None
                    else False
                ),
                "ageGated": obj.get("ageGated"),
                "directLending": obj.get("directLending"),
                "subscriberOptin": (
                    obj.get("subscriberOptin")
                    if obj.get("subscriberOptin") is not None
                    else False
                ),
                "subscriberOptout": (
                    obj.get("subscriberOptout")
                    if obj.get("subscriberOptout") is not None
                    else False
                ),
                "subscriberHelp": (
                    obj.get("subscriberHelp")
                    if obj.get("subscriberHelp") is not None
                    else False
                ),
                "sample1": obj.get("sample1"),
                "sample2": obj.get("sample2"),
                "sample3": obj.get("sample3"),
                "sample4": obj.get("sample4"),
                "sample5": obj.get("sample5"),
                "messageFlow": obj.get("messageFlow"),
                "helpMessage": obj.get("helpMessage"),
                "optinKeywords": obj.get("optinKeywords"),
                "optoutKeywords": obj.get("optoutKeywords"),
                "helpKeywords": obj.get("helpKeywords"),
                "optinMessage": obj.get("optinMessage"),
                "optoutMessage": obj.get("optoutMessage"),
                "brand": (
                    SMSTenDLCPartnerCampaignBrand.from_dict(obj["brand"])
                    if obj.get("brand") is not None
                    else None
                ),
            }
        )
        return _obj
