43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
from uuid import UUID
|
|
|
|
from pydantic import Field
|
|
|
|
from .common import ApiEnvelope, JsonObject, JsonValue, RouteContract, SchemaModel
|
|
|
|
HTTP_METHOD = 'POST'
|
|
ROUTE_PATH = '/api/crop-simulation/current-farm-chart/'
|
|
|
|
|
|
class CropSimulationCurrentFarmChartRequest(SchemaModel):
|
|
farm_uuid: UUID
|
|
plant_name: str | None = None
|
|
|
|
|
|
class CropSimulationCurrentFarmChartResponseData(SchemaModel):
|
|
farm_uuid: str | None = None
|
|
plant_name: str | None = None
|
|
engine: str | None = None
|
|
model_name: str | None = None
|
|
scenario_id: int | None = None
|
|
simulation_warning: str | None = None
|
|
categories: list[str] = Field(default_factory=list)
|
|
series: JsonValue | None = None
|
|
summary: JsonObject = Field(default_factory=dict)
|
|
current_state: JsonObject = Field(default_factory=dict)
|
|
metrics: JsonObject = Field(default_factory=dict)
|
|
daily_output: JsonObject = Field(default_factory=dict)
|
|
|
|
|
|
class CropSimulationCurrentFarmChartResponse(ApiEnvelope[CropSimulationCurrentFarmChartResponseData]):
|
|
pass
|
|
|
|
|
|
CONTRACT = RouteContract(
|
|
method=HTTP_METHOD,
|
|
path=ROUTE_PATH,
|
|
request_model=CropSimulationCurrentFarmChartRequest.__name__,
|
|
response_model=CropSimulationCurrentFarmChartResponse.__name__,
|
|
)
|