101 lines
2.8 KiB
Python
101 lines
2.8 KiB
Python
from pydantic import BaseModel, Field
|
|
from typing import Optional
|
|
|
|
|
|
# ─── Collection ───────────────────────────────────────────────
|
|
class Collection(BaseModel):
|
|
date: str = Field(description="Collection date YYYY-MM-DD")
|
|
type: str = Field(description="Waste type label")
|
|
daysUntil: int = Field(description="Days until collection")
|
|
icon: Optional[str] = Field(default=None, description="MDI icon name")
|
|
|
|
|
|
# ─── Source descriptors ────────────────────────────────────────
|
|
class SourceInfo(BaseModel):
|
|
id: str
|
|
name: str
|
|
|
|
|
|
class SourceParam(BaseModel):
|
|
name: str
|
|
type: str
|
|
required: bool
|
|
example: str
|
|
|
|
|
|
class SourceDetailResponse(BaseModel):
|
|
id: str
|
|
name: str
|
|
params: list[SourceParam]
|
|
|
|
|
|
class SourceListResponse(BaseModel):
|
|
count: int
|
|
sources: list[SourceInfo]
|
|
|
|
|
|
# ─── Request bodies ────────────────────────────────────────────
|
|
class ICSRequest(BaseModel):
|
|
url: str = Field(description="Direct URL to .ics / .ical file")
|
|
count: int = Field(default=20, ge=1, le=100)
|
|
|
|
|
|
class AbfallIORequest(BaseModel):
|
|
key: str = Field(description="Abfall.IO API key")
|
|
f_id_kommune: int = Field(description="Municipality ID")
|
|
f_id_strasse: int = Field(description="Street ID")
|
|
count: int = Field(default=20, ge=1, le=100)
|
|
|
|
|
|
class AWMRequest(BaseModel):
|
|
street: str = Field(description="Street name in Munich")
|
|
house_number: str = Field(description="House number")
|
|
count: int = Field(default=20, ge=1, le=100)
|
|
|
|
|
|
class StuttgartRequest(BaseModel):
|
|
street: str = Field(description="Street name in Stuttgart")
|
|
streetnr: int = Field(description="House number")
|
|
count: int = Field(default=20, ge=1, le=100)
|
|
|
|
|
|
class NotifyRequest(BaseModel):
|
|
source_id: str
|
|
collection: Collection
|
|
notify_at_days_before: int = Field(default=1, ge=0)
|
|
channels: list[str] = Field(description='Notification channels, e.g. ["telegram"]')
|
|
chat_id: int
|
|
|
|
|
|
# ─── Response wrappers ─────────────────────────────────────────
|
|
class CollectionsResponse(BaseModel):
|
|
source: str
|
|
collections: list[Collection]
|
|
|
|
|
|
class Notification(BaseModel):
|
|
id: str
|
|
source_id: str
|
|
collection_type: str
|
|
collection_date: str
|
|
notify_at_days_before: int
|
|
channels: list[str]
|
|
chat_id: int
|
|
fired: bool
|
|
|
|
|
|
class NotificationsResponse(BaseModel):
|
|
count: int
|
|
notifications: list[Notification]
|
|
|
|
|
|
class NotifyResponse(BaseModel):
|
|
ok: bool
|
|
notification_id: str
|
|
message: str
|
|
|
|
|
|
class DeleteResponse(BaseModel):
|
|
ok: bool
|
|
deleted: str
|