from pydantic import BaseModel from typing import List, Optional from enum import Enum class MelodyType(str, Enum): orthodox = "orthodox" catholic = "catholic" all = "all" class MelodyTone(str, Enum): normal = "normal" festive = "festive" cheerful = "cheerful" lamentation = "lamentation" class MelodyInfo(BaseModel): name: str description: str = "" melodyTone: MelodyTone = MelodyTone.normal customTags: List[str] = [] minSpeed: int = 0 maxSpeed: int = 0 totalNotes: int = 1 steps: int = 0 color: str = "" isTrueRing: bool = False previewURL: str = "" notes: List[int] = [] class MelodyAttributes(BaseModel): speed: int = 0 duration: int = 0 totalRunDuration: int = 0 pauseDuration: int = 0 infiniteLoop: bool = False echoRing: List[int] = [] noteAssignments: List[int] = [] # --- Request / Response schemas --- class MelodyCreate(BaseModel): information: MelodyInfo default_settings: MelodyAttributes type: MelodyType = MelodyType.all url: str = "" uid: str = "" pid: str = "" class MelodyUpdate(BaseModel): information: Optional[MelodyInfo] = None default_settings: Optional[MelodyAttributes] = None type: Optional[MelodyType] = None url: Optional[str] = None uid: Optional[str] = None pid: Optional[str] = None class MelodyInDB(MelodyCreate): id: str class MelodyListResponse(BaseModel): melodies: List[MelodyInDB] total: int