from __future__ import annotations from pydantic import Field from .common import ApiEnvelope, EmptyRequest, JsonObject, JsonValue, RouteContract, SchemaModel class IrrigationMethodPayload(SchemaModel): name: str category: str | None = None description: str | None = None water_efficiency_percent: float | None = None water_pressure_required: str | None = None flow_rate: str | None = None coverage_area: str | None = None soil_type: str | None = None climate_suitability: str | None = None class IrrigationMethodPartialPayload(SchemaModel): name: str | None = None category: str | None = None description: str | None = None water_efficiency_percent: float | None = None water_pressure_required: str | None = None flow_rate: str | None = None coverage_area: str | None = None soil_type: str | None = None climate_suitability: str | None = None class IrrigationMethodSchema(IrrigationMethodPayload): id: int created_at: str | None = None updated_at: str | None = None class IrrigationMethodDetailRequest(SchemaModel): pk: int class IrrigationMethodListResponse(ApiEnvelope[list[IrrigationMethodSchema]]): pass class IrrigationMethodDetailResponse(ApiEnvelope[IrrigationMethodSchema]): pass class IrrigationMethodDeleteResponse(ApiEnvelope[JsonValue | None]): pass CONTRACTS = [ RouteContract( method='GET', path='/api/irrigation/', request_model=EmptyRequest.__name__, response_model=IrrigationMethodListResponse.__name__, ), RouteContract( method='POST', path='/api/irrigation/', request_model=IrrigationMethodPayload.__name__, response_model=IrrigationMethodDetailResponse.__name__, ), RouteContract( method='GET', path='/api/irrigation//', request_model=IrrigationMethodDetailRequest.__name__, response_model=IrrigationMethodDetailResponse.__name__, ), RouteContract( method='PUT', path='/api/irrigation//', request_model=IrrigationMethodPayload.__name__, response_model=IrrigationMethodDetailResponse.__name__, ), RouteContract( method='PATCH', path='/api/irrigation//', request_model=IrrigationMethodPartialPayload.__name__, response_model=IrrigationMethodDetailResponse.__name__, ), RouteContract( method='DELETE', path='/api/irrigation//', request_model=IrrigationMethodDetailRequest.__name__, response_model=IrrigationMethodDeleteResponse.__name__, ), ]