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

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .continuous_reading_alert_threshold_response_body_operation import (
    ContinuousReadingAlertThresholdResponseBodyOperation,
)
from .continuous_reading_alert_threshold_response_body_unit import ContinuousReadingAlertThresholdResponseBodyUnit


class ContinuousReadingAlertThresholdResponseBody(UniversalBaseModel):
    """
    The threshold value of the alert for continuous readings.
    """

    operation: ContinuousReadingAlertThresholdResponseBodyOperation = pydantic.Field()
    """
    The operation used when comparing the value to the threshold.  Valid values: `GREATER`, `INSIDE_RANGE`, `LESS`, `OUTSIDE_RANGE`
    """

    threshold: int = pydantic.Field()
    """
    The lower threshold of criticality.
    """

    unit: typing.Optional[ContinuousReadingAlertThresholdResponseBodyUnit] = pydantic.Field(default=None)
    """
    The unit of the threshold defined by reading type.  Valid values: `ampere`, `bar`, `cad`, `celsius`, `chf`, `day`, `decimaldegrees`, `eur`, `fahrenheit`, `foot`, `gallon`, `gallonperkilogram`, `gallonsperhour`, `galpermi`, `gbp`, `gforce`, `gperliter`, `gperm`, `hertz`, `hour`, `imperialgallonperkilogram`, `impgallon`, `impgallonsperhour`, `impgalpermi`, `inch`, `kelvin`, `kgper100kmgaseousfuel`, `kgpergallon`, `kgperkm`, `kgperliter`, `kgpermi`, `kilogram`, `kilogramgaseousfuel`, `kilometer`, `kilopascal`, `kilowatthour`, `kmperhr`, `kmperl`, `kmperlgaseousfuel`, `lbpermi`, `liter`, `litergaseousfuel`, `literperkilogram`, `literpertonne`, `litersperhour`, `lper100km`, `lper100kmgaseousfuel`, `lperkm`, `lperm`, `meter`, `meterspersec`, `mile`, `milliknot`, `millisecond`, `millivolt`, `minute`, `mipergal`, `miperhr`, `miperimpgal`, `month`, `mpgusgalgaseousfuel`, `mpkggaseousfuel`, `mxn`, `percent`, `pound`, `poundsPerSquareInch`, `poundspergallon`, `poundsperliter`, `rpm`, `second`, `usd`, `usgallongaseousfuel`, `volt`, `voltAmpere`, `voltAmpereReactive`, `watt`, `watthour`, `week`
    """

    upper_threshold: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="upperThreshold"),
        pydantic.Field(
            alias="upperThreshold", description="The upper threshold of criticality. Required for RANGE operations."
        ),
    ] = 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
