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="BackfillingEntryPlan")
[docs]
@_attrs_define
class BackfillingEntryPlan:
"""Instructions on how a backfilling activity should be performed."""
target_depth: float | None | Unset = UNSET
""" The desired depth of the hole after backfilling (Meters). Cannot be negative. """
crew_check_required: bool | Unset = UNSET
""" Whether or not the hole requires re-dipping after backfilling by the crew. """
supervisor_check_required: bool | Unset = UNSET
""" Whether or not the hole requires re-dipping after backfilling by the supervisor. """
[docs]
def to_dict(self) -> dict[str, Any]:
target_depth: float | None | Unset
if isinstance(self.target_depth, Unset):
target_depth = UNSET
else:
target_depth = self.target_depth
crew_check_required = self.crew_check_required
supervisor_check_required = self.supervisor_check_required
field_dict: dict[str, Any] = {}
field_dict.update({})
if target_depth is not UNSET:
field_dict["targetDepth"] = target_depth
if crew_check_required is not UNSET:
field_dict["crewCheckRequired"] = crew_check_required
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_target_depth(data: object) -> float | None | Unset:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(float | None | Unset, data)
target_depth = _parse_target_depth(d.pop("targetDepth", UNSET))
crew_check_required = d.pop("crewCheckRequired", UNSET)
supervisor_check_required = d.pop("supervisorCheckRequired", UNSET)
backfilling_entry_plan = cls(
target_depth=target_depth,
crew_check_required=crew_check_required,
supervisor_check_required=supervisor_check_required,
)
return backfilling_entry_plan