Files

38 lines
975 B
Python
Raw Permalink Normal View History

2026-04-27 03:12:33 +03:30
from __future__ import annotations
from uuid import UUID
from pydantic import Field
from .common import ApiEnvelope, JsonObject, RouteContract, SchemaModel
HTTP_METHOD = 'POST'
ROUTE_PATH = '/api/crop-simulation/harvest-prediction/'
class CropSimulationHarvestPredictionRequest(SchemaModel):
farm_uuid: UUID
plant_name: str | None = None
class CropSimulationHarvestPredictionResponseData(SchemaModel):
date: str
dateFormatted: str
daysUntil: int
description: str | None = None
optimalWindowStart: str | None = None
optimalWindowEnd: str | None = None
gddDetails: JsonObject = Field(default_factory=dict)
class CropSimulationHarvestPredictionResponse(ApiEnvelope[CropSimulationHarvestPredictionResponseData]):
pass
CONTRACT = RouteContract(
method=HTTP_METHOD,
path=ROUTE_PATH,
request_model=CropSimulationHarvestPredictionRequest.__name__,
response_model=CropSimulationHarvestPredictionResponse.__name__,
)