# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .health_details_response_response_body import HealthDetailsResponseResponseBody
from .health_reason_response_response_body import HealthReasonResponseResponseBody
from .health_response_response_body_health_status import HealthResponseResponseBodyHealthStatus
from .health_response_response_body_primary_health_reason import HealthResponseResponseBodyPrimaryHealthReason
from .health_response_response_body_recommended_action import HealthResponseResponseBodyRecommendedAction


class HealthResponseResponseBody(UniversalBaseModel):
    """
    Health information for the device.
    """

    health_details: typing_extensions.Annotated[
        typing.Optional[HealthDetailsResponseResponseBody],
        FieldMetadata(alias="healthDetails"),
        pydantic.Field(alias="healthDetails"),
    ] = None
    health_reasons: typing_extensions.Annotated[
        typing.Optional[typing.List[HealthReasonResponseResponseBody]],
        FieldMetadata(alias="healthReasons"),
        pydantic.Field(alias="healthReasons", description="The list of active health reasons affecting this device."),
    ] = None
    health_status: typing_extensions.Annotated[
        typing.Optional[HealthResponseResponseBodyHealthStatus],
        FieldMetadata(alias="healthStatus"),
        pydantic.Field(
            alias="healthStatus",
            description="Current overall health status of the device.  Valid values: `dataPending`, `healthy`, `needsAttention`, `needsReplacement`",
        ),
    ] = None
    primary_health_reason: typing_extensions.Annotated[
        typing.Optional[HealthResponseResponseBodyPrimaryHealthReason],
        FieldMetadata(alias="primaryHealthReason"),
        pydantic.Field(
            alias="primaryHealthReason",
            description="Primary health reason affecting the device's current health status.  Valid values: `assetUnplugged`, `cameraMisaligned`, `dataPending`, `healthy`, `inwardCameraObstruction`, `irregularRecording`, `lowDeviceBattery`, `missingEldDiagnostics`, `missingVin`, `needsReplacement`, `newlyInstalledDevice`, `noGpsSignal`, `notDetected`, `outwardCameraObstruction`, `recordingTimeRequired`, `unknown`, `vgUnplugged`",
        ),
    ] = None
    primary_health_reason_start_time: typing_extensions.Annotated[
        typing.Optional[dt.datetime],
        FieldMetadata(alias="primaryHealthReasonStartTime"),
        pydantic.Field(
            alias="primaryHealthReasonStartTime",
            description="The timestamp when the primary health reason began, in RFC3339 format.",
        ),
    ] = None
    recommended_action: typing_extensions.Annotated[
        typing.Optional[HealthResponseResponseBodyRecommendedAction],
        FieldMetadata(alias="recommendedAction"),
        pydantic.Field(
            alias="recommendedAction",
            description="Recommended steps to resolve the current health reason.\n\n* `recommendedActionAgHealthy`: Gateway is healthy. No action required.\n* `recommendedActionAgLowDeviceBatteryAG45`: The gateway battery is low. Please contact support\n* `recommendedActionAgLowDeviceBatteryAG46`: The gateway battery is low. Gateway batteries require replacement.\n* `recommendedActionAgLowDeviceBatteryAG51`: Gateway batteries require replacement.\n* `recommendedActionAgLowDeviceBatteryPoweredAG`: The gateway battery is low. Power on the asset to charge the gateway.\n* `recommendedActionAgNoGpsSignal`: Gateway has no GPS signal. Verify that the gateway is securely attached to the exterior of the asset. Ensure that the device is outside and avoid obstructions such as underground structures, heavily insulated buildings, bridges, and trees.\n* `recommendedActionAgNotDetected`: The gateway has not been detected for at least 24 hours. See troubleshooting steps to reboot the gateway.\n* `recommendedActionAgUnplugged`: The asset gateway is unplugged or cut. Check the gateway connection to ensure it is plugged in and has been installed correctly\n* `recommendedActionBLEDataPending`: This device has recently been installed and more data is required to calculate health. No action required.\n* `recommendedActionBLEHealthy`: Device is healthy. No action required.\n* `recommendedActionBLELowBattery`: The device battery is low. Please contact support.\n* `recommendedActionBLENotDetected`: The device has not been detected by a gateway in the Samsara Network for at least 30 days. Verify that the device is securely attached to the asset, not in a remote area, and minimize obstructions that may disrupt detection by nearby gateways.\n* `recommendedActionCcHealthy`: Device is healthy. No action required.\n* `recommendedActionCcLowUptime`: Please ensure all cameras are physically connected to the device.\n* `recommendedActionCcMediaInputUptime`: Please ensure the camera is properly connected to the device.\n* `recommendedActionCcNotDetected`: None\n* `recommendedActionCmCameraMisaligned`: The position of the road-facing dash cam is not aligned with the horizon. Video quality and AI detection may be impacted. Reposition dash cam and Test Dash Cam Positioning.\n* `recommendedActionCmHealthy`: Dash cam recording is healthy. No action required.\n* `recommendedActionCmInactive`: None\n* `recommendedActionCmInwardCameraObstruction`: The inward-facing dash cam does not have a clear view of the vehicle cab. Video quality and AI detection may be impacted. Remove obstruction and Test Dash Cam Positioning.\n* `recommendedActionCmIrregularRecording`: The dash cam shows no evidence of recording during the expected recording time over the last 30 days. Please contact Support.\n* `recommendedActionCmLowUptime`: The dash cam is either experiencing low recording uptime, low connectivity, or both. Please follow the troubleshooting steps and contact Support if issues persist.\n* `recommendedActionCmNewlyInstalledDevice`: This dash cam has recently been installed and at least 30 hours of recording time is required to calculate health. No action required.\n* `recommendedActionCmNotDetected`: The dash cam has not been detected within the last 30 days. Check the dash cam's connection and verify your dash cam has been installed correctly.\n* `recommendedActionCmOutwardCameraObstruction`: The outward-facing dash cam does not have a clear view of the road. Video quality and AI detection may be impacted Remove obstruction and Test Dash Cam Positioning.\n* `recommendedActionCmRecordingTimeRequired`: At least 30 hours of recording time is required to determine device health. No action required.\n* `recommendedActionCmVgUnplugged`: The vehicle gateway is unplugged and the dash cam health cannot be determined. Check the vehicle gateway connection and ensure it is plugged in and has been installed correctly.\n* `recommendedActionGatewayNewlyInstalledDevice`: This gateway has recently been installed and more data is required to calculate health. No action required.\n* `recommendedActionHealthy`: Asset is healthy. No action required.\n* `recommendedActionLowBatteryVoltage`: Asset has reported low battery voltage. Please contact support.\n* `recommendedActionOemNotReporting`: Data for this asset has not been received as expected. Please contact support.\n* `recommendedActionVehicleOff`: Asset has reported an expected power-off event, and is healthy. No action required.\n* `recommendedActionVgHealthy`: Gateway is healthy. No action required.\n* `recommendedActionVgMissingEldDiagnostics`: To ensure full compliance, request exchange.\n* `recommendedActionVgMissingEldDiagnosticsExchangeSubmitted`: Exchange submitted. Please allow 12-24 hours for exchange to appear in the orders and exchanges page.\n* `recommendedActionVgMissingEldDiagnosticsHardwareExchanged`: Install exchanged hardware.\n* `recommendedActionVgMissingEldDiagnosticsNoExchangeSubmitted`: To ensure full compliance, request exchange.\n* `recommendedActionVgMissingVin`: Add the VIN to your vehicle.\n* `recommendedActionVgNeedsReplacement`: To ensure full compliance, request exchange.\n* `recommendedActionVgNotDetected`: The vehicle gateway has not been detected for at least 24 hours. Check the vehicle gateway connection to ensure it is plugged in and view additional troubleshooting steps.\n* `recommendedActionVgVgUnplugged`: The vehicle gateway is unplugged. Check the vehicle gateway connection to ensure it is plugged in and has been installed correctly.\n* `unknown`: None\n\n\n  Valid values: `recommendedActionAgHealthy`, `recommendedActionAgLowDeviceBatteryAG45`, `recommendedActionAgLowDeviceBatteryAG46`, `recommendedActionAgLowDeviceBatteryAG51`, `recommendedActionAgLowDeviceBatteryPoweredAG`, `recommendedActionAgNoGpsSignal`, `recommendedActionAgNotDetected`, `recommendedActionAgUnplugged`, `recommendedActionBLEDataPending`, `recommendedActionBLEHealthy`, `recommendedActionBLELowBattery`, `recommendedActionBLENotDetected`, `recommendedActionCcHealthy`, `recommendedActionCcLowUptime`, `recommendedActionCcMediaInputUptime`, `recommendedActionCcNotDetected`, `recommendedActionCmCameraMisaligned`, `recommendedActionCmHealthy`, `recommendedActionCmInactive`, `recommendedActionCmInwardCameraObstruction`, `recommendedActionCmIrregularRecording`, `recommendedActionCmLowUptime`, `recommendedActionCmNewlyInstalledDevice`, `recommendedActionCmNotDetected`, `recommendedActionCmOutwardCameraObstruction`, `recommendedActionCmRecordingTimeRequired`, `recommendedActionCmVgUnplugged`, `recommendedActionGatewayNewlyInstalledDevice`, `recommendedActionHealthy`, `recommendedActionLowBatteryVoltage`, `recommendedActionOemNotReporting`, `recommendedActionVehicleOff`, `recommendedActionVgHealthy`, `recommendedActionVgMissingEldDiagnostics`, `recommendedActionVgMissingEldDiagnosticsExchangeSubmitted`, `recommendedActionVgMissingEldDiagnosticsHardwareExchanged`, `recommendedActionVgMissingEldDiagnosticsNoExchangeSubmitted`, `recommendedActionVgMissingVin`, `recommendedActionVgNeedsReplacement`, `recommendedActionVgNotDetected`, `recommendedActionVgVgUnplugged`, `unknown`",
        ),
    ] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
