"""Request bodies for the system registry router.""" from __future__ import annotations import uuid from pydantic import BaseModel, Field from app.domains.system_registry import constants as const class SystemCreateRequest(BaseModel): name: str = Field(..., min_length=1, max_length=const.MAX_NAME_CHARS) slug: str | None = Field(None, max_length=64) kind: str = const.KIND_OTHER exposure: str = const.EXPOSURE_UNKNOWN status: str = const.STATUS_ACTIVE hostnames: list[str] | None = None description: str | None = Field(None, max_length=const.MAX_NOTES_CHARS) repo: str | None = Field(None, max_length=255) owner_person_id: uuid.UUID | None = None backup_owner_person_id: uuid.UUID | None = None budget_track: str = const.TRACK_PRODUCT in_bounty_scope: bool = False notes: str | None = Field(None, max_length=const.MAX_NOTES_CHARS) class SystemUpdateRequest(BaseModel): """Every field optional; only the keys present are written. ``model_dump(exclude_unset=True)`` at the router is what makes "clear the repo URL" (``repo: null``) distinguishable from "leave the repo alone" (key absent). """ name: str | None = Field(None, min_length=1, max_length=const.MAX_NAME_CHARS) kind: str | None = None exposure: str | None = None status: str | None = None hostnames: list[str] | None = None description: str | None = Field(None, max_length=const.MAX_NOTES_CHARS) repo: str | None = Field(None, max_length=255) budget_track: str | None = None in_bounty_scope: bool | None = None notes: str | None = Field(None, max_length=const.MAX_NOTES_CHARS) class OwnerTransferRequest(BaseModel): owner_person_id: uuid.UUID | None = None backup_owner_person_id: uuid.UUID | None = None #: Whether ``backup_owner_person_id`` should be applied at all. See #: ``service.transfer_owner`` — one nullable field cannot express #: both "leave it" and "clear it". set_backup: bool = False note: str | None = Field(None, max_length=const.MAX_NOTES_CHARS) class RetireRequest(BaseModel): note: str | None = Field(None, max_length=const.MAX_NOTES_CHARS)