from pydantic import BaseModel, ConfigDict from pydantic.alias_generators import to_camel from datetime import datetime class LibraryFolder(BaseModel): model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True) id: str full_path: str library_id: str = "" added_at: int = 0 class LibrarySettings(BaseModel): model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True) cover_aspect_ratio: int = 1 disable_watcher: bool = False skip_matching_media_with_asin: bool = False skip_matching_media_with_isbn: bool = False auto_scan_cron_expression: str = "" audio_files_global_include: list[str] = [] audio_files_global_exclude: list[str] = [] metadata_precision: int = 10 hide_single_book_series: bool = False only_show_later_books_in_continue_series: bool = False metadata_providers: list[str] = ["google", "audible"] prefer_matched_metadata: bool = False disable_embed_covers: bool = False best_books_matching: bool = False class LibraryOut(BaseModel): model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True) id: str name: str folders: list[LibraryFolder] = [] display_order: int = 1 icon: str = "database" media_type: str = "book" provider: str = "google" settings: LibrarySettings = LibrarySettings() created_at: int = 0 # ABS nutzt Unix-Timestamps in ms last_update: int = 0 class LibraryCreate(BaseModel): name: str folders: list[dict] media_type: str = "book" icon: str = "database" provider: str = "google" class LibraryUpdate(BaseModel): name: str | None = None folders: list[dict] | None = None settings: dict | None = None class LibraryItemsResponse(BaseModel): model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True) results: list total: int limit: int page: int