# 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.asset_group_editorial_status import AssetGroupEditorialStatus
from openapi_client.models.campaign.asset_group_search_theme import AssetGroupSearchTheme
from openapi_client.models.campaign.asset_group_status import AssetGroupStatus
from openapi_client.models.campaign.asset_group_url_target import AssetGroupUrlTarget
from openapi_client.models.campaign.asset_link import AssetLink
from openapi_client.models.campaign.call_to_action import CallToAction
from openapi_client.models.campaign.key_value_pair_ofstring_andstring import KeyValuePairOfstringAndstring
from openapi_client.models.campaign.model_date import ModelDate
from typing_extensions import Self

class AssetGroup(BaseModel):
    """
    AssetGroup
    """ # noqa: E501
    id: Optional[StrictStr] = Field(default=None, alias="Id")
    name: Optional[StrictStr] = Field(default=None, alias="Name")
    status: Optional[AssetGroupStatus] = Field(default=None, alias="Status")
    start_date: Optional[ModelDate] = Field(default=None, alias="StartDate")
    end_date: Optional[ModelDate] = Field(default=None, alias="EndDate")
    path1: Optional[StrictStr] = Field(default=None, alias="Path1")
    path2: Optional[StrictStr] = Field(default=None, alias="Path2")
    business_name: Optional[StrictStr] = Field(default=None, alias="BusinessName")
    headlines: Optional[List[Optional[AssetLink]]] = Field(default=None, alias="Headlines")
    long_headlines: Optional[List[Optional[AssetLink]]] = Field(default=None, alias="LongHeadlines")
    descriptions: Optional[List[Optional[AssetLink]]] = Field(default=None, alias="Descriptions")
    images: Optional[List[Optional[AssetLink]]] = Field(default=None, alias="Images")
    videos: Optional[List[Optional[AssetLink]]] = Field(default=None, alias="Videos")
    call_to_action: Optional[CallToAction] = Field(default=None, alias="CallToAction")
    final_urls: Optional[List[StrictStr]] = Field(default=None, alias="FinalUrls")
    asset_group_search_themes: Optional[List[Optional[AssetGroupSearchTheme]]] = Field(default=None, alias="AssetGroupSearchThemes")
    final_mobile_urls: Optional[List[StrictStr]] = Field(default=None, alias="FinalMobileUrls")
    editorial_status: Optional[AssetGroupEditorialStatus] = Field(default=None, alias="EditorialStatus")
    asset_group_url_targets: Optional[List[Optional[AssetGroupUrlTarget]]] = Field(default=None, alias="AssetGroupUrlTargets")
    forward_compatibility_map: Optional[List[Optional[KeyValuePairOfstringAndstring]]] = Field(default=None, alias="ForwardCompatibilityMap")
    __properties: ClassVar[List[str]] = ["Id", "Name", "Status", "StartDate", "EndDate", "Path1", "Path2", "BusinessName", "Headlines", "LongHeadlines", "Descriptions", "Images", "Videos", "CallToAction", "FinalUrls", "AssetGroupSearchThemes", "FinalMobileUrls", "EditorialStatus", "AssetGroupUrlTargets", "ForwardCompatibilityMap"]

    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 start_date
        if self.start_date:
            _dict['StartDate'] = self.start_date.to_dict()
        # override the default output from pydantic by calling `to_dict()` of end_date
        if self.end_date:
            _dict['EndDate'] = self.end_date.to_dict()
        # override the default output from pydantic by calling `to_dict()` of each item in headlines (list)
        _items = []
        if self.headlines:
            for _item_headlines in self.headlines:
                if _item_headlines:
                    _items.append(_item_headlines.to_dict())
            _dict['Headlines'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in long_headlines (list)
        _items = []
        if self.long_headlines:
            for _item_long_headlines in self.long_headlines:
                if _item_long_headlines:
                    _items.append(_item_long_headlines.to_dict())
            _dict['LongHeadlines'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in descriptions (list)
        _items = []
        if self.descriptions:
            for _item_descriptions in self.descriptions:
                if _item_descriptions:
                    _items.append(_item_descriptions.to_dict())
            _dict['Descriptions'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in images (list)
        _items = []
        if self.images:
            for _item_images in self.images:
                if _item_images:
                    _items.append(_item_images.to_dict())
            _dict['Images'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in videos (list)
        _items = []
        if self.videos:
            for _item_videos in self.videos:
                if _item_videos:
                    _items.append(_item_videos.to_dict())
            _dict['Videos'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in asset_group_search_themes (list)
        _items = []
        if self.asset_group_search_themes:
            for _item_asset_group_search_themes in self.asset_group_search_themes:
                if _item_asset_group_search_themes:
                    _items.append(_item_asset_group_search_themes.to_dict())
            _dict['AssetGroupSearchThemes'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in asset_group_url_targets (list)
        _items = []
        if self.asset_group_url_targets:
            for _item_asset_group_url_targets in self.asset_group_url_targets:
                if _item_asset_group_url_targets:
                    _items.append(_item_asset_group_url_targets.to_dict())
            _dict['AssetGroupUrlTargets'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in forward_compatibility_map (list)
        _items = []
        if self.forward_compatibility_map:
            for _item_forward_compatibility_map in self.forward_compatibility_map:
                if _item_forward_compatibility_map:
                    _items.append(_item_forward_compatibility_map.to_dict())
            _dict['ForwardCompatibilityMap'] = _items
        # 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 status (nullable) is None
        # and model_fields_set contains the field
        if self.status is None and "status" in self.model_fields_set:
            _dict['Status'] = None

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of AssetGroup 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,
                        "Status": obj.get("Status") if obj.get("Status") is not None else None,
                        "StartDate": ModelDate.from_dict(obj["StartDate"]) if obj.get("StartDate") is not None else None,
                        "EndDate": ModelDate.from_dict(obj["EndDate"]) if obj.get("EndDate") is not None else None,
                        "Path1": obj.get("Path1") if obj.get("Path1") is not None else None,
                        "Path2": obj.get("Path2") if obj.get("Path2") is not None else None,
                        "BusinessName": obj.get("BusinessName") if obj.get("BusinessName") is not None else None,
                        "Headlines": [AssetLink.from_dict(_item) for _item in obj["Headlines"]] if obj.get("Headlines") is not None else None,
                        "LongHeadlines": [AssetLink.from_dict(_item) for _item in obj["LongHeadlines"]] if obj.get("LongHeadlines") is not None else None,
                        "Descriptions": [AssetLink.from_dict(_item) for _item in obj["Descriptions"]] if obj.get("Descriptions") is not None else None,
                        "Images": [AssetLink.from_dict(_item) for _item in obj["Images"]] if obj.get("Images") is not None else None,
                        "Videos": [AssetLink.from_dict(_item) for _item in obj["Videos"]] if obj.get("Videos") is not None else None,
                        "CallToAction": obj.get("CallToAction") if obj.get("CallToAction") is not None else None,
                        "FinalUrls": obj.get("FinalUrls"),
                        "AssetGroupSearchThemes": [AssetGroupSearchTheme.from_dict(_item) for _item in obj["AssetGroupSearchThemes"]] if obj.get("AssetGroupSearchThemes") is not None else None,
                        "FinalMobileUrls": obj.get("FinalMobileUrls"),
                        "EditorialStatus": obj.get("EditorialStatus") if obj.get("EditorialStatus") is not None else None,
                        "AssetGroupUrlTargets": [AssetGroupUrlTarget.from_dict(_item) for _item in obj["AssetGroupUrlTargets"]] if obj.get("AssetGroupUrlTargets") is not None else None,
                        "ForwardCompatibilityMap": [KeyValuePairOfstringAndstring.from_dict(_item) for _item in obj["ForwardCompatibilityMap"]] if obj.get("ForwardCompatibilityMap") is not None else None
        })
        return _obj
