# 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, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class BrowserResponseM(BaseModel):
    """
    BrowserResponseM
    """ # 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
    user_agent: Optional[StrictStr] = Field(default=None, alias="userAgent")
    simple_software: Optional[StrictStr] = Field(default=None, alias="simpleSoftware")
    software: Optional[StrictStr] = None
    software_name: Optional[StrictStr] = Field(default=None, alias="softwareName")
    operating_system: Optional[StrictStr] = Field(default=None, alias="operatingSystem")
    operating_system_flavour: Optional[StrictStr] = Field(default=None, alias="operatingSystemFlavour")
    operating_system_version: Optional[StrictStr] = Field(default=None, alias="operatingSystemVersion")
    is_abusive: Optional[StrictBool] = Field(default=None, alias="isAbusive")
    check_status: Optional[StrictStr] = Field(default=None, alias="checkStatus")
    __properties: ClassVar[List[str]] = ["messageId", "correlationId", "idempotencyKey", "inError", "errorType", "messages", "userAgent", "simpleSoftware", "software", "softwareName", "operatingSystem", "operatingSystemFlavour", "operatingSystemVersion", "isAbusive", "checkStatus"]

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

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

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

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

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

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

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

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

        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of BrowserResponseM 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"),
            "userAgent": obj.get("userAgent"),
            "simpleSoftware": obj.get("simpleSoftware"),
            "software": obj.get("software"),
            "softwareName": obj.get("softwareName"),
            "operatingSystem": obj.get("operatingSystem"),
            "operatingSystemFlavour": obj.get("operatingSystemFlavour"),
            "operatingSystemVersion": obj.get("operatingSystemVersion"),
            "isAbusive": obj.get("isAbusive"),
            "checkStatus": obj.get("checkStatus")
        })
        return _obj


