# 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.key_value_pair_ofstring_andstring import KeyValuePairOfstringAndstring
from openapi_client.models.bulk.operation_error import OperationError
from typing_extensions import Self

class GetBulkDownloadStatusResponse(BaseModel):
    """
    GetBulkDownloadStatusResponse
    """ # noqa: E501
    request_status: Optional[StrictStr] = Field(default=None, alias="RequestStatus")
    result_file_url: Optional[StrictStr] = Field(default=None, alias="ResultFileUrl")
    percent_complete: Optional[StrictInt] = Field(default=None, alias="PercentComplete")
    forward_compatibility_map: Optional[List[Optional[KeyValuePairOfstringAndstring]]] = Field(default=None, alias="ForwardCompatibilityMap")
    errors: Optional[List[Optional[OperationError]]] = Field(default=None, alias="Errors")
    __properties: ClassVar[List[str]] = ["RequestStatus", "ResultFileUrl", "PercentComplete", "ForwardCompatibilityMap", "Errors"]

    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 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
        # override the default output from pydantic by calling `to_dict()` of each item in errors (list)
        _items = []
        if self.errors:
            for _item_errors in self.errors:
                if _item_errors:
                    _items.append(_item_errors.to_dict())
            _dict['Errors'] = _items
        # set to None if request_status (nullable) is None
        # and model_fields_set contains the field
        if self.request_status is None and "request_status" in self.model_fields_set:
            _dict['RequestStatus'] = None

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "RequestStatus": obj.get("RequestStatus") if obj.get("RequestStatus") is not None else None,
                        "ResultFileUrl": obj.get("ResultFileUrl") if obj.get("ResultFileUrl") is not None else None,
                        "PercentComplete": obj.get("PercentComplete") if obj.get("PercentComplete") is not None else None,
                        "ForwardCompatibilityMap": [KeyValuePairOfstringAndstring.from_dict(_item) for _item in obj["ForwardCompatibilityMap"]] if obj.get("ForwardCompatibilityMap") is not None else None,
                        "Errors": [OperationError.from_dict(_item) for _item in obj["Errors"]] if obj.get("Errors") is not None else None
        })
        return _obj
