# 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 .reading_trigger_continuous_value_object_request_body_operation import (
    ReadingTriggerContinuousValueObjectRequestBodyOperation,
)
from .reading_trigger_continuous_value_object_request_body_unit import (
    ReadingTriggerContinuousValueObjectRequestBodyUnit,
)


class ReadingTriggerContinuousValueObjectRequestBody(UniversalBaseModel):
    """
    Threshold to alert on if reading is continuous, either enum or continuous threshold may be set.
    """

    operation: ReadingTriggerContinuousValueObjectRequestBodyOperation = pydantic.Field()
    """
    The operation to use 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[ReadingTriggerContinuousValueObjectRequestBodyUnit] = pydantic.Field(default=None)
    """
    The unit of the threshold defined by reading type. If not provided base unit of the reading will be used.  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
