# coding: utf-8

"""
    ReportingService

    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 BatchError(BaseModel):
    """
    BatchError
    """ # noqa: E501
    code: Optional[StrictInt] = Field(default=None, alias="Code")
    error_code: Optional[StrictStr] = Field(default=None, alias="ErrorCode")
    details: Optional[StrictStr] = Field(default=None, alias="Details")
    index: Optional[StrictInt] = Field(default=None, alias="Index")
    message: Optional[StrictStr] = Field(default=None, alias="Message")
    __properties: ClassVar[List[str]] = ["Code", "ErrorCode", "Details", "Index", "Message"]

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "Code": obj.get("Code") if obj.get("Code") is not None else None,
                        "ErrorCode": obj.get("ErrorCode") if obj.get("ErrorCode") is not None else None,
                        "Details": obj.get("Details") if obj.get("Details") is not None else None,
                        "Index": obj.get("Index") if obj.get("Index") is not None else None,
                        "Message": obj.get("Message") if obj.get("Message") is not None else None
        })
        return _obj
