"""Track schemas.""" from pydantic import BaseModel, ConfigDict, Field from contributor.api.schemas.contributors import ContributorKey from contributor.api.schemas.display_artists import DisplayArtist from contributor.api.schemas.schema_examples import with_example class TrackKey(BaseModel): model_config = ConfigDict(title="Key identifying a track.") tuid: int = Field(description="The track's internal ID.") class TrackDataloaderRequest(BaseModel): model_config = ConfigDict( title="Request body for loading multiple tracks by key.", json_schema_extra=with_example("track_dataloader_request"), ) tracks: list[TrackKey] = Field(description="List of track keys to load.") class TrackParticipationForContributor(BaseModel): model_config = ConfigDict(title="A track participation for a contributor.") contributor: ContributorKey = Field( description="The contributor associated with this participation." ) participated_as: str = Field( description="The role the contributor played on the track." ) track: TrackKey = Field(description="The track identifier.") track_artist_id: int | None = Field(description="The track artist's internal ID.") class TrackParticipationsResponse(BaseModel): model_config = ConfigDict( title="Track participations for a contributor.", json_schema_extra=with_example("track_participations_response"), ) contributor: ContributorKey = Field(description="UUID of the contributor.") participations: list[TrackParticipationForContributor] = Field( default=[], description="List of track participations." ) class TrackParticipation(BaseModel): model_config = ConfigDict(title="A contributor participation on a track.") contributor: ContributorKey = Field( description="The contributor participating on the track." ) participated_as: str = Field(description="The role the contributor played.") track: TrackKey = Field(description="The track's internal ID.") track_artist_id: int | None = Field( default=None, description="The matching track artist internal ID, if present.", ) class TrackParticipations(BaseModel): model_config = ConfigDict( title="Contributor participations for a track.", json_schema_extra=with_example("track_participations"), ) track: TrackKey = Field(description="The track's internal ID.") participations: list[TrackParticipation] = Field( default=[], description="List of contributor participations on the track." ) display_artists: list[DisplayArtist] = Field( default=[], description="List of display artists on the track." )