Files
govoplan-portal/src/govoplan_portal/backend/schemas.py
T

53 lines
1.4 KiB
Python

from __future__ import annotations
from datetime import datetime
from typing import Any
from pydantic import BaseModel, ConfigDict, Field
class PortalServiceEntryResponse(BaseModel):
model_config = ConfigDict(extra="forbid")
definition: dict[str, Any]
state: str
reason_codes: list[str] = Field(default_factory=list)
entry_binding: dict[str, Any] | None = None
availability_evidence: list[dict[str, Any]] = Field(default_factory=list)
class PortalServiceListResponse(BaseModel):
model_config = ConfigDict(extra="forbid")
services: list[PortalServiceEntryResponse]
class PortalServiceLaunchRequest(BaseModel):
model_config = ConfigDict(extra="forbid")
service_version: str = Field(min_length=1, max_length=120)
idempotency_key: str = Field(min_length=1, max_length=255)
requested_at: datetime
parameters: dict[str, Any] = Field(default_factory=dict, max_length=100)
class PortalServiceLaunchResponse(BaseModel):
model_config = ConfigDict(extra="forbid")
service_ref: dict[str, Any]
binding: dict[str, Any]
state: str
target_ref: dict[str, Any] | None = None
href: str | None = None
replayed: bool = False
evidence: list[dict[str, Any]] = Field(default_factory=list)
metadata: dict[str, Any] = Field(default_factory=dict)
__all__ = [
"PortalServiceEntryResponse",
"PortalServiceLaunchRequest",
"PortalServiceLaunchResponse",
"PortalServiceListResponse",
]