Files
Logic/Modules/SensorHub/Schemas/irrigation_water_stress.py
T

36 lines
865 B
Python
Raw Normal View History

2026-05-11 03:27:21 +03:30
from __future__ import annotations
from typing import Literal
from uuid import UUID
from pydantic import Field
from .common import ApiEnvelope, JsonObject, RouteContract, SchemaModel
HTTP_METHOD = 'POST'
ROUTE_PATH = '/api/irrigation/water-stress/'
class IrrigationWaterStressRequest(SchemaModel):
farm_uuid: UUID
sensor_uuid: UUID | None = None
class IrrigationWaterStressResponseData(SchemaModel):
farm_uuid: str
waterStressIndex: int | float
level: Literal['low', 'medium', 'high'] | str
sourceMetric: JsonObject = Field(default_factory=dict)
class IrrigationWaterStressResponse(ApiEnvelope[IrrigationWaterStressResponseData]):
pass
CONTRACT = RouteContract(
method=HTTP_METHOD,
path=ROUTE_PATH,
request_model=IrrigationWaterStressRequest.__name__,
response_model=IrrigationWaterStressResponse.__name__,
)