from datetime import datetime from typing import Literal, Optional from pydantic import BaseModel, Field class NoteBase(BaseModel): title: str = Field(..., min_length=1, max_length=255) content: str = Field(..., min_length=1) class NoteCreate(NoteBase): pass class NoteUpdate(BaseModel): title: Optional[str] = Field(None, min_length=1, max_length=255) content: Optional[str] = Field(None, min_length=1) class NoteInDB(NoteBase): id: int created_at: datetime updated_at: datetime class Config: from_attributes = True class Note(NoteInDB): pass class NoteExport(BaseModel): format: Literal["markdown", "txt", "pdf"] = "markdown"