"""
Paginated result for playlistsMetadataList query.
Results are sorted by follower count descending.
"""
type PlaylistsMetadataListResult {
    "Distinct available values for each filter dimension, derived from the matched playlist set"
    filterOptions: PlaylistFilterOptions!
    "Paginated list of playlist metadata"
    items: [Playlist!]!
    "Total number of playlists matching the inputs (before pagination)"
    totalCount: Int!
}

"Available distinct values for the account, owner, and type filter dropdowns."
type PlaylistFilterOptions {
    "Distinct CURATOR_NAME values available in the current playlist set"
    account: [String!]!
    "Distinct OWNER values available in the current playlist set"
    owner: [String!]!
    "Distinct PLAYLIST_TYPE values available in the current playlist set"
    type: [PlaylistType!]!
}

"""
Playlist metadata from Snowflake data source.
"""
type Playlist @key(fields: "playlistId source { storeId } storefront") {
    # Add aliases matching frontend unified names (for eventual consolidation)
    "Alias for playlistArtworkUrl (deprecated)"
    artworkUrl: String @deprecated(reason: "Use playlistArtworkUrl")
    "Alias for playlistFollowerCount (deprecated)"
    followerCount: Int @deprecated(reason: "Use playlistFollowerCount")
    "Frontline track percentage breakdown by label"
    frontlinePercent: LabelPercent
    "Checks whether detailed playlist metadata is available for this playlist"
    hasMetadata(
        "Include hourly playlists in the check (defaults to feature flag value)"
        includeHourly: Boolean
        "Include non-priority playlists in the check (defaults to feature flag value)"
        includeNonPriorityPlaylists: Boolean
    ): Boolean!
    "Alias for playlistId (deprecated)"
    id: ID! @deprecated(reason: "Use playlistId")
    "Last time the playlist metadata was updated (nullable)"
    lastUpdated: String
    "Local track percentage breakdown by country and region"
    localPercent: LocalPercent
    "Alias for playlistName (deprecated)"
    name: String @deprecated(reason: "Use playlistName for consistency")
    "Calculated owner of the playlist based on curator information"
    owner: String @shareable
    "URL to the playlist artwork image"
    playlistArtworkUrl: String @shareable
    "Curator information for the playlist"
    playlistCurator: PlaylistCurator! @shareable
    "Number of followers for the playlist"
    playlistFollowerCount: Float @shareable
    "Genres associated with the playlist"
    playlistGenres: [String!]! @shareable
    "Unique identifier for the playlist (Spotify, Apple, etc)"
    playlistId: ID! @shareable
    "Display name of the playlist"
    playlistName: String! @shareable
    "Number of tracks in the playlist"
    playlistTrackCount: Int @shareable
    "Type/category of the playlist (e.g. EDITORIAL, USER)"
    playlistType: PlaylistType! @shareable
    "URI for the playlist (e.g. `https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M?si=50kdxE06QQipS6qsslVM2Q`)"
    playlistUri: String! @shareable
    "URL for the playlist (e.g. `spotify:playlist:37i9dQZF1DXcBWIGoYBM5M`)"
    playlistUrl: String! @shareable
    "Primary type/category of the playlist (e.g. HOT_HITS)"
    primaryPlaylistType: String
    "SMG (Sony Music Group) ownership percentage breakdown by label"
    smgPercent: LabelPercent
    "Source platform information (store ID and name) - derived from STORE_ID"
    source: Store! @shareable
    "Store-specific playlist identifier (same as playlistId, for backward compatibility)"
    storePlaylistId: ID! @shareable
    "Storefront information for the playlist (Apple Music regional storefront like 'US', 'GB', etc. - null for Spotify playlists)"
    storefront: String @shareable
    "Display name of the user who created the playlist (derived from playlistCurator.curatorName for backward compatibility)"
    userDisplayName: String! @shareable
}

type PlaylistCurator @key(fields: "curatorId") @key(fields: "id") {
    # Add aliases matching frontend unified names (for gradual migration)
    "Alias for curatorCountry (deprecated)"
    country: String @deprecated(reason: "Use curatorCountry")
    "Country of the curator"
    curatorCountry: String @shareable
    "Unique identifier for the curator"
    curatorId: String @shareable
    "Display name of the curator"
    curatorName: String @shareable
    "Alias for curatorId (deprecated)"
    id: ID @deprecated(reason: "Use curatorId")
    "Alias for curatorName (deprecated)"
    name: String @deprecated(reason: "Use curatorName")
}

"""
Label percentage breakdown showing ownership distribution across music labels.
Used for SMG (Sony Music Group) and Frontline track percentages.
Returns an array of label code and percentage value pairs.
"""
type LabelPercent {
    "Array of label percentages with label code and value"
    labels: [LabelPercentItem!]!
}

"""
Individual label percentage item with code and value.
"""
type LabelPercentItem {
    "Label code (e.g., 'theorchard', 'sme', 'smg', 'knr', etc.)"
    code: String!
    "Percentage value for this label"
    value: Float!
}

"""
Local track percentage breakdown by geographic regions and countries.
Provides detailed distribution of locally-relevant tracks across different markets.
"""
type LocalPercent {
    "Country-level breakdown of local track percentages"
    countries: [CountryPercent!]
    "Convenience groupings of countries (e.g., 'GSA', 'Nordics', 'ex-us')"
    quickSelections: [QuickSelection!]
    "Region-level breakdown (continents: Europe, North America, etc.)"
    regions: [RegionPercent!]
}

"""
Country-specific percentage of local tracks.
"""
type CountryPercent {
    "ISO country code (e.g., 'US', 'GB', 'DE')"
    code: String!
    "Percentage value for this country"
    value: Float!
}

"""
Region-specific percentage of local tracks (continental groupings).
"""
type RegionPercent {
    "Region code (e.g., 'Europe', 'North America', 'Other')"
    code: String!
    "Percentage value for this region"
    value: Float!
}

"""
Quick selection grouping for regional market segments.
"""
type QuickSelection {
    "Quick selection code (e.g., 'GSA', 'Nordics', 'ex-us')"
    code: String!
    "Percentage value for this quick selection"
    value: Float!
}
