2026-09-04 17:34:03 -05:00
|
|
|
"""Shared response building blocks used across entity schemas.
|
|
|
|
|
|
|
|
|
|
These are hand-written Pydantic models, never SQLAlchemy models serialized
|
|
|
|
|
directly — see section 18 of the build spec.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from datetime import date
|
|
|
|
|
|
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ORMModel(BaseModel):
|
|
|
|
|
"""Base for schemas built from ORM rows via `model_validate(obj)`."""
|
|
|
|
|
|
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GenreOut(ORMModel):
|
|
|
|
|
id: str
|
|
|
|
|
name: str
|
|
|
|
|
|
|
|
|
|
|
2026-09-06 00:05:10 -05:00
|
|
|
class GenreListOut(BaseModel):
|
|
|
|
|
page: int
|
|
|
|
|
page_size: int
|
|
|
|
|
total_results: int
|
|
|
|
|
total_pages: int
|
|
|
|
|
results: list[GenreOut] = []
|
|
|
|
|
|
|
|
|
|
|
2026-09-04 17:34:03 -05:00
|
|
|
class KeywordOut(ORMModel):
|
|
|
|
|
id: str
|
|
|
|
|
name: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ArtworkOut(BaseModel):
|
|
|
|
|
id: str
|
|
|
|
|
type: str
|
|
|
|
|
language: str | None = None
|
|
|
|
|
width: int | None = None
|
|
|
|
|
height: int | None = None
|
|
|
|
|
aspect_ratio: float | None = None
|
|
|
|
|
url: str
|
|
|
|
|
provider: str | None = None
|
|
|
|
|
is_primary: bool = False
|
|
|
|
|
vote_average: float | None = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ImagesOut(BaseModel):
|
|
|
|
|
posters: list[ArtworkOut] = []
|
|
|
|
|
backdrops: list[ArtworkOut] = []
|
|
|
|
|
logos: list[ArtworkOut] = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VideoOut(BaseModel):
|
|
|
|
|
id: str
|
|
|
|
|
type: str
|
|
|
|
|
site: str | None = None
|
|
|
|
|
url: str
|
|
|
|
|
language: str | None = None
|
|
|
|
|
country: str | None = None
|
|
|
|
|
is_official: bool = False
|
|
|
|
|
published_at: date | None = None
|
|
|
|
|
provider: str | None = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ExternalIDsOut(BaseModel):
|
|
|
|
|
"""Provider slug -> native ID, e.g. {"tmdb": "550", "imdb": "tt0137523"}."""
|
|
|
|
|
|
|
|
|
|
model_config = ConfigDict(extra="allow")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PersonBriefOut(BaseModel):
|
|
|
|
|
id: str
|
|
|
|
|
name: str
|
|
|
|
|
profile_path: str | None = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CastCreditOut(BaseModel):
|
|
|
|
|
id: str
|
|
|
|
|
person: PersonBriefOut
|
|
|
|
|
character: str | None = None
|
|
|
|
|
billing_order: int | None = None
|
|
|
|
|
episode_count: int | None = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CrewCreditOut(BaseModel):
|
|
|
|
|
id: str
|
|
|
|
|
person: PersonBriefOut
|
|
|
|
|
department: str
|
|
|
|
|
job: str | None = None
|
|
|
|
|
episode_count: int | None = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CreditsOut(BaseModel):
|
|
|
|
|
cast: list[CastCreditOut] = []
|
|
|
|
|
crew: list[CrewCreditOut] = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CompanyBriefOut(BaseModel):
|
|
|
|
|
id: str
|
|
|
|
|
name: str
|
|
|
|
|
company_type: str
|
|
|
|
|
logo_path: str | None = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CollectionBriefOut(BaseModel):
|
|
|
|
|
id: str
|
|
|
|
|
name: str
|
2026-09-05 20:08:26 -05:00
|
|
|
poster_path: str | None = None
|
2026-09-04 17:34:03 -05:00
|
|
|
|
|
|
|
|
|
2026-09-06 04:07:18 -05:00
|
|
|
class CertificationOut(BaseModel):
|
|
|
|
|
system: str
|
|
|
|
|
rating: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ReleaseDateOut(BaseModel):
|
|
|
|
|
country_code: str
|
|
|
|
|
release_date: date
|
|
|
|
|
release_type: str | None = None
|
|
|
|
|
certification: CertificationOut | None = None
|
|
|
|
|
note: str | None = None
|
|
|
|
|
|
|
|
|
|
|
2026-09-04 17:34:03 -05:00
|
|
|
class ErrorDetail(BaseModel):
|
|
|
|
|
code: str
|
|
|
|
|
message: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ErrorResponse(BaseModel):
|
|
|
|
|
error: ErrorDetail
|