# coding: utf-8

"""
    BulkService

    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.bulk.campaign_scope import CampaignScope
from openapi_client.models.bulk.compression_type import CompressionType
from openapi_client.models.bulk.data_scope import DataScope
from openapi_client.models.bulk.download_entity import DownloadEntity
from openapi_client.models.bulk.download_file_type import DownloadFileType
from typing_extensions import Self

class DownloadCampaignsByCampaignIdsRequest(BaseModel):
    """
    DownloadCampaignsByCampaignIdsRequest
    """ # noqa: E501
    campaigns: Optional[List[Optional[CampaignScope]]] = Field(default=None, alias="Campaigns")
    last_sync_time_in_utc: Optional[datetime] = Field(default=None, alias="LastSyncTimeInUTC")
    download_entities: Optional[List[Optional[DownloadEntity]]] = Field(default=None, alias="DownloadEntities")
    data_scope: Optional[DataScope] = Field(default=None, alias="DataScope")
    download_file_type: Optional[DownloadFileType] = Field(default=None, alias="DownloadFileType")
    format_version: Optional[StrictStr] = Field(default=None, alias="FormatVersion")
    compression_type: Optional[CompressionType] = Field(default=None, alias="CompressionType")
    __properties: ClassVar[List[str]] = ["Campaigns", "LastSyncTimeInUTC", "DownloadEntities", "DataScope", "DownloadFileType", "FormatVersion", "CompressionType"]

    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 each item in campaigns (list)
        _items = []
        if self.campaigns:
            for _item_campaigns in self.campaigns:
                if _item_campaigns:
                    _items.append(_item_campaigns.to_dict())
            _dict['Campaigns'] = _items
        # set to None if campaigns (nullable) is None
        # and model_fields_set contains the field
        if self.campaigns is None and "campaigns" in self.model_fields_set:
            _dict['Campaigns'] = None

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "Campaigns": [CampaignScope.from_dict(_item) for _item in obj["Campaigns"]] if obj.get("Campaigns") is not None else None,
                        "LastSyncTimeInUTC": obj.get("LastSyncTimeInUTC") if obj.get("LastSyncTimeInUTC") is not None else None,
                        "DownloadEntities": obj.get("DownloadEntities"),
                        "DataScope": obj.get("DataScope") if obj.get("DataScope") is not None else None,
                        "DownloadFileType": obj.get("DownloadFileType") if obj.get("DownloadFileType") is not None else None,
                        "FormatVersion": obj.get("FormatVersion") if obj.get("FormatVersion") is not None else None,
                        "CompressionType": obj.get("CompressionType") if obj.get("CompressionType") is not None else None
        })
        return _obj
