UPDATE
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
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__,
|
||||
)
|
||||
Reference in New Issue
Block a user