# 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 OfflineConversion(BaseModel):
    """
    OfflineConversion
    """ # noqa: E501
    microsoft_click_id: Optional[StrictStr] = Field(default=None, alias="MicrosoftClickId")
    conversion_name: Optional[StrictStr] = Field(default=None, alias="ConversionName")
    conversion_time: Optional[datetime] = Field(default=None, alias="ConversionTime")
    conversion_value: Optional[StrictFloat] = Field(default=None, alias="ConversionValue")
    conversion_currency_code: Optional[StrictStr] = Field(default=None, alias="ConversionCurrencyCode")
    external_attribution_credit: Optional[StrictFloat] = Field(default=None, alias="ExternalAttributionCredit")
    external_attribution_model: Optional[StrictStr] = Field(default=None, alias="ExternalAttributionModel")
    hashed_email_address: Optional[StrictStr] = Field(default=None, alias="HashedEmailAddress")
    hashed_phone_number: Optional[StrictStr] = Field(default=None, alias="HashedPhoneNumber")
    __properties: ClassVar[List[str]] = ["MicrosoftClickId", "ConversionName", "ConversionTime", "ConversionValue", "ConversionCurrencyCode", "ExternalAttributionCredit", "ExternalAttributionModel", "HashedEmailAddress", "HashedPhoneNumber"]

    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 microsoft_click_id (nullable) is None
        # and model_fields_set contains the field
        if self.microsoft_click_id is None and "microsoft_click_id" in self.model_fields_set:
            _dict['MicrosoftClickId'] = None

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "MicrosoftClickId": obj.get("MicrosoftClickId") if obj.get("MicrosoftClickId") is not None else None,
                        "ConversionName": obj.get("ConversionName") if obj.get("ConversionName") is not None else None,
                        "ConversionTime": obj.get("ConversionTime") if obj.get("ConversionTime") is not None else None,
                        "ConversionValue": obj.get("ConversionValue") if obj.get("ConversionValue") is not None else None,
                        "ConversionCurrencyCode": obj.get("ConversionCurrencyCode") if obj.get("ConversionCurrencyCode") is not None else None,
                        "ExternalAttributionCredit": obj.get("ExternalAttributionCredit") if obj.get("ExternalAttributionCredit") is not None else None,
                        "ExternalAttributionModel": obj.get("ExternalAttributionModel") if obj.get("ExternalAttributionModel") is not None else None,
                        "HashedEmailAddress": obj.get("HashedEmailAddress") if obj.get("HashedEmailAddress") is not None else None,
                        "HashedPhoneNumber": obj.get("HashedPhoneNumber") if obj.get("HashedPhoneNumber") is not None else None
        })
        return _obj
