# coding: utf-8

"""
    Onboarding Buddy API

    This document details all the available operations in the Onboarding Buddy API specification

    The version of the OpenAPI document: v1
    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 pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class FileUploadResponseM(BaseModel):
    """
    FileUploadResponseM
    """ # noqa: E501
    message_id: Optional[StrictStr] = Field(default=None, alias="messageId")
    correlation_id: Optional[StrictStr] = Field(default=None, alias="correlationId")
    idempotency_key: Optional[StrictStr] = Field(default=None, alias="idempotencyKey")
    in_error: Optional[StrictBool] = Field(default=None, alias="inError")
    error_type: Optional[StrictStr] = Field(default=None, alias="errorType")
    messages: Optional[List[StrictStr]] = None
    global_id: Optional[StrictStr] = Field(default=None, alias="globalId")
    organisation_global_id: Optional[StrictStr] = Field(default=None, alias="organisationGlobalId")
    application_global_id: Optional[StrictStr] = Field(default=None, alias="applicationGlobalId")
    file_name: Optional[StrictStr] = Field(default=None, alias="fileName")
    mime_type: Optional[StrictStr] = Field(default=None, alias="mimeType")
    file_size: Optional[StrictInt] = Field(default=None, alias="fileSize")
    file_status: Optional[StrictStr] = Field(default=None, alias="fileStatus")
    active: Optional[StrictBool] = None
    __properties: ClassVar[List[str]] = ["messageId", "correlationId", "idempotencyKey", "inError", "errorType", "messages", "globalId", "organisationGlobalId", "applicationGlobalId", "fileName", "mimeType", "fileSize", "fileStatus", "active"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )


    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of FileUploadResponseM from a JSON string"""
        return cls.from_dict(json.loads(json_str))

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

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

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

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "messageId": obj.get("messageId"),
            "correlationId": obj.get("correlationId"),
            "idempotencyKey": obj.get("idempotencyKey"),
            "inError": obj.get("inError"),
            "errorType": obj.get("errorType"),
            "messages": obj.get("messages"),
            "globalId": obj.get("globalId"),
            "organisationGlobalId": obj.get("organisationGlobalId"),
            "applicationGlobalId": obj.get("applicationGlobalId"),
            "fileName": obj.get("fileName"),
            "mimeType": obj.get("mimeType"),
            "fileSize": obj.get("fileSize"),
            "fileStatus": obj.get("fileStatus"),
            "active": obj.get("active")
        })
        return _obj


