package com.fabledsword.minstrel.models.wire

import kotlinx.serialization.Serializable

/**
 * Server's `Page[T]` envelope for search results — three concrete
 * variants since kotlinx.serialization's generic support is fine but
 * the three call sites are easier to read with explicit types.
 *
 * `total` reflects the full match count for that facet (not just
 * what fit in `items` at this offset/limit). The mobile UI only
 * walks the first page today; infinite scroll per facet is a future
 * enhancement.
 */
@Serializable
data class PagedArtistsWire(
    val items: List<ArtistWire> = emptyList(),
    val total: Int = 0,
    val limit: Int = 0,
    val offset: Int = 0,
)

@Serializable
data class PagedAlbumsWire(
    val items: List<AlbumWire> = emptyList(),
    val total: Int = 0,
    val limit: Int = 0,
    val offset: Int = 0,
)

@Serializable
data class PagedTracksWire(
    val items: List<TrackWire> = emptyList(),
    val total: Int = 0,
    val limit: Int = 0,
    val offset: Int = 0,
)

/**
 * `GET /api/search` response envelope. Three facets keyed by entity
 * type, each independently paged.
 */
@Serializable
data class SearchResponseWire(
    val artists: PagedArtistsWire = PagedArtistsWire(),
    val albums: PagedAlbumsWire = PagedAlbumsWire(),
    val tracks: PagedTracksWire = PagedTracksWire(),
)
