# coding: utf-8

"""
    perceptic-core-server API

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 0.0.1-SNAPSHOT
    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
from typing import Any, ClassVar, Dict, List, Optional
from perceptic_core_client.models.json_node_type import JsonNodeType
from typing import Optional, Set
from typing_extensions import Self

class JsonNode(BaseModel):
    """
    JsonNode
    """ # noqa: E501
    empty: Optional[StrictBool] = None
    value_node: Optional[StrictBool] = Field(default=None, alias="valueNode")
    container_node: Optional[StrictBool] = Field(default=None, alias="containerNode")
    missing_node: Optional[StrictBool] = Field(default=None, alias="missingNode")
    array: Optional[StrictBool] = None
    object: Optional[StrictBool] = None
    node_type: Optional[JsonNodeType] = Field(default=None, alias="nodeType")
    pojo: Optional[StrictBool] = None
    number: Optional[StrictBool] = None
    integral_number: Optional[StrictBool] = Field(default=None, alias="integralNumber")
    floating_point_number: Optional[StrictBool] = Field(default=None, alias="floatingPointNumber")
    short: Optional[StrictBool] = None
    int: Optional[StrictBool] = None
    long: Optional[StrictBool] = None
    var_float: Optional[StrictBool] = Field(default=None, alias="float")
    double: Optional[StrictBool] = None
    big_decimal: Optional[StrictBool] = Field(default=None, alias="bigDecimal")
    big_integer: Optional[StrictBool] = Field(default=None, alias="bigInteger")
    textual: Optional[StrictBool] = None
    boolean: Optional[StrictBool] = None
    null: Optional[StrictBool] = None
    binary: Optional[StrictBool] = None
    __properties: ClassVar[List[str]] = ["empty", "valueNode", "containerNode", "missingNode", "array", "object", "nodeType", "pojo", "number", "integralNumber", "floatingPointNumber", "short", "int", "long", "float", "double", "bigDecimal", "bigInteger", "textual", "boolean", "null", "binary"]

    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 JsonNode 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,
        )
        return _dict

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

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

        _obj = cls.model_validate({
            "empty": obj.get("empty"),
            "valueNode": obj.get("valueNode"),
            "containerNode": obj.get("containerNode"),
            "missingNode": obj.get("missingNode"),
            "array": obj.get("array"),
            "object": obj.get("object"),
            "nodeType": obj.get("nodeType"),
            "pojo": obj.get("pojo"),
            "number": obj.get("number"),
            "integralNumber": obj.get("integralNumber"),
            "floatingPointNumber": obj.get("floatingPointNumber"),
            "short": obj.get("short"),
            "int": obj.get("int"),
            "long": obj.get("long"),
            "float": obj.get("float"),
            "double": obj.get("double"),
            "bigDecimal": obj.get("bigDecimal"),
            "bigInteger": obj.get("bigInteger"),
            "textual": obj.get("textual"),
            "boolean": obj.get("boolean"),
            "null": obj.get("null"),
            "binary": obj.get("binary")
        })
        return _obj


