# 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_listing_type import AssetGroupListingType
from openapi_client.models.campaign.product_condition import ProductCondition
from typing_extensions import Self

class AssetGroupListingGroup(BaseModel):
    """
    AssetGroupListingGroup
    """ # noqa: E501
    id: Optional[StrictStr] = Field(default=None, alias="Id")
    asset_group_id: Optional[StrictStr] = Field(default=None, alias="AssetGroupId")
    asset_group_listing_type: Optional[AssetGroupListingType] = Field(default=None, alias="AssetGroupListingType")
    parent_listing_group_id: Optional[StrictStr] = Field(default=None, alias="ParentListingGroupId")
    dimension: Optional[ProductCondition] = Field(default=None, alias="Dimension")
    is_excluded: Optional[StrictBool] = Field(default=None, alias="IsExcluded")
    listing_group_path: Optional[StrictStr] = Field(default=None, alias="ListingGroupPath")
    __properties: ClassVar[List[str]] = ["Id", "AssetGroupId", "AssetGroupListingType", "ParentListingGroupId", "Dimension", "IsExcluded", "ListingGroupPath"]

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

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

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

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

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

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

        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of AssetGroupListingGroup 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,
                        "AssetGroupId": obj.get("AssetGroupId") if obj.get("AssetGroupId") is not None else None,
                        "AssetGroupListingType": obj.get("AssetGroupListingType") if obj.get("AssetGroupListingType") is not None else None,
                        "ParentListingGroupId": obj.get("ParentListingGroupId") if obj.get("ParentListingGroupId") is not None else None,
                        "Dimension": ProductCondition.from_dict(obj["Dimension"]) if obj.get("Dimension") is not None else None,
                        "IsExcluded": obj.get("IsExcluded") if obj.get("IsExcluded") is not None else None,
                        "ListingGroupPath": obj.get("ListingGroupPath") if obj.get("ListingGroupPath") is not None else None
        })
        return _obj
