UPDATE
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Literal
|
||||
from uuid import UUID
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
from .common import ApiEnvelope, RouteContract, SchemaModel
|
||||
|
||||
HTTP_METHOD = 'POST'
|
||||
ROUTE_PATH = '/api/fertilization/recommend/'
|
||||
|
||||
|
||||
class FertilizationRecommendRequest(SchemaModel):
|
||||
farm_uuid: UUID
|
||||
sensor_uuid: UUID | None = None
|
||||
plant_name: str | None = None
|
||||
growth_stage: str | None = None
|
||||
query: str | None = None
|
||||
|
||||
|
||||
class FertilizationSection(SchemaModel):
|
||||
type: Literal['recommendation', 'list', 'warning', 'info']
|
||||
title: str
|
||||
icon: str | None = None
|
||||
content: str | None = None
|
||||
items: list[str] = Field(default_factory=list)
|
||||
fertilizerType: str | None = None
|
||||
amount: str | None = None
|
||||
applicationMethod: str | None = None
|
||||
timing: str | None = None
|
||||
validityPeriod: str | None = None
|
||||
expandableExplanation: str | None = None
|
||||
|
||||
|
||||
class FertilizationRecommendResponseData(SchemaModel):
|
||||
sections: list[FertilizationSection] = Field(default_factory=list)
|
||||
|
||||
|
||||
class FertilizationRecommendResponse(ApiEnvelope[FertilizationRecommendResponseData]):
|
||||
pass
|
||||
|
||||
|
||||
CONTRACT = RouteContract(
|
||||
method=HTTP_METHOD,
|
||||
path=ROUTE_PATH,
|
||||
request_model=FertilizationRecommendRequest.__name__,
|
||||
response_model=FertilizationRecommendResponse.__name__,
|
||||
)
|
||||
Reference in New Issue
Block a user