# 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 openapi_client.models.campaign.customer_share import CustomerShare
from openapi_client.models.campaign.uet_tag_tracking_status import UetTagTrackingStatus
from typing_extensions import Self

class UetTag(BaseModel):
    """
    UetTag
    """ # noqa: E501
    id: Optional[StrictStr] = Field(default=None, alias="Id")
    name: Optional[StrictStr] = Field(default=None, alias="Name")
    description: Optional[StrictStr] = Field(default=None, alias="Description")
    tracking_script: Optional[StrictStr] = Field(default=None, alias="TrackingScript")
    tracking_no_script: Optional[StrictStr] = Field(default=None, alias="TrackingNoScript")
    tracking_status: Optional[UetTagTrackingStatus] = Field(default=None, alias="TrackingStatus")
    customer_share: Optional[CustomerShare] = Field(default=None, alias="CustomerShare")
    __properties: ClassVar[List[str]] = ["Id", "Name", "Description", "TrackingScript", "TrackingNoScript", "TrackingStatus", "CustomerShare"]

    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,
        )
        # override the default output from pydantic by calling `to_dict()` of customer_share
        if self.customer_share:
            _dict['CustomerShare'] = self.customer_share.to_dict()
        # set to None if id (nullable) is None
        # and model_fields_set contains the field
        if self.id is None and "id" in self.model_fields_set:
            _dict['Id'] = None

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "Id": obj.get("Id") if obj.get("Id") is not None else None,
                        "Name": obj.get("Name") if obj.get("Name") is not None else None,
                        "Description": obj.get("Description") if obj.get("Description") is not None else None,
                        "TrackingScript": obj.get("TrackingScript") if obj.get("TrackingScript") is not None else None,
                        "TrackingNoScript": obj.get("TrackingNoScript") if obj.get("TrackingNoScript") is not None else None,
                        "TrackingStatus": obj.get("TrackingStatus") if obj.get("TrackingStatus") is not None else None,
                        "CustomerShare": CustomerShare.from_dict(obj["CustomerShare"]) if obj.get("CustomerShare") is not None else None
        })
        return _obj
