from __future__ import annotations
from collections.abc import Mapping
from typing import Any, TypeVar, cast
from attrs import define as _attrs_define
from ..types import UNSET, Unset
T = TypeVar("T", bound="DippingEntryPlanModel")
[docs]
@_attrs_define
class DippingEntryPlanModel:
"""Instructions on how to dip the holes."""
last_known_depth: float | None | Unset = UNSET
""" The last known depth of the hole when this entry was created (Meters). Can be null if unknown. """
supervisor_check_required: bool | Unset = UNSET
""" Whether the supervisor is required to validate the dip measurements. """
[docs]
def to_dict(self) -> dict[str, Any]:
last_known_depth: float | None | Unset
if isinstance(self.last_known_depth, Unset):
last_known_depth = UNSET
else:
last_known_depth = self.last_known_depth
supervisor_check_required = self.supervisor_check_required
field_dict: dict[str, Any] = {}
field_dict.update({})
if last_known_depth is not UNSET:
field_dict["lastKnownDepth"] = last_known_depth
if supervisor_check_required is not UNSET:
field_dict["supervisorCheckRequired"] = supervisor_check_required
return field_dict
[docs]
@classmethod
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
d = dict(src_dict)
def _parse_last_known_depth(data: object) -> float | None | Unset:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(float | None | Unset, data)
last_known_depth = _parse_last_known_depth(d.pop("lastKnownDepth", UNSET))
supervisor_check_required = d.pop("supervisorCheckRequired", UNSET)
dipping_entry_plan_model = cls(
last_known_depth=last_known_depth,
supervisor_check_required=supervisor_check_required,
)
return dipping_entry_plan_model