# coding: utf-8

"""
    ToolHub Customer API

    REST API for customer access to ToolHub well data.  ## Authentication  All endpoints require Bearer token authentication using an API key:  ``` Authorization: Bearer thub_live_xxxxxxxxxxxxxxxxxxxx ```  API keys are issued per-organization and inherit well access permissions.  ## Rate Limits  - Standard tier: 70 requests/minute - Premium tier: 300 requests/minute

    The version of the OpenAPI document: 0.1.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 pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing import Optional, Set
from typing_extensions import Self

class GetSurvey200ResponseBodyDataRaw(BaseModel):
    """
    GetSurvey200ResponseBodyDataRaw
    """ # noqa: E501
    gx: Optional[Union[StrictFloat, StrictInt]]
    gy: Optional[Union[StrictFloat, StrictInt]]
    gz: Optional[Union[StrictFloat, StrictInt]]
    mx: Optional[Union[StrictFloat, StrictInt]]
    my: Optional[Union[StrictFloat, StrictInt]]
    mz: Optional[Union[StrictFloat, StrictInt]]
    temperature: Optional[Union[StrictFloat, StrictInt]]
    dip_angle: Optional[Union[StrictFloat, StrictInt]]
    magnetic_field: Optional[Union[StrictFloat, StrictInt]]
    total_gravity: Optional[Union[StrictFloat, StrictInt]]
    __properties: ClassVar[List[str]] = ["gx", "gy", "gz", "mx", "my", "mz", "temperature", "dip_angle", "magnetic_field", "total_gravity"]

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

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

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "gx": obj.get("gx"),
            "gy": obj.get("gy"),
            "gz": obj.get("gz"),
            "mx": obj.get("mx"),
            "my": obj.get("my"),
            "mz": obj.get("mz"),
            "temperature": obj.get("temperature"),
            "dip_angle": obj.get("dip_angle"),
            "magnetic_field": obj.get("magnetic_field"),
            "total_gravity": obj.get("total_gravity")
        })
        return _obj


