package org.dueattendant149.bookshelf.data.remote.bookshelfapi.model

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class SearchResponse(
    val results: List<SearchResultItemResponse> = emptyList(),
    @SerialName("search_time_ms")
    val searchTimeMs: Int = 0,
    val total: Int = 0,
)

@Serializable
data class SearchResultItemResponse(
    val source: String = "",
    val title: String = "",
    val author: String = "",
    val format: String = "",
    @SerialName("media_type")
    val mediaType: String = "",
    @SerialName("size_human")
    val sizeHuman: String = "",
    val seeders: Int? = null,
    val score: Double = 0.0,
    val guid: String = "",
    val md5: String = "",
    @SerialName("magnet_url")
    val magnetUrl: String = "",
    @SerialName("download_url")
    val downloadUrl: String = "",
    val url: String = "",
    @SerialName("cover_url")
    val coverUrl: String = "",
    @SerialName("info_hash")
    val infoHash: String = "",
    @SerialName("download_protocol")
    val downloadProtocol: String = "",
)

@Serializable
data class SearchRequest(
    val query: String,
    val author: String? = null,
    @SerialName("media_type")
    val mediaType: String? = null,
    val format: String? = null,
    val language: String? = null,
    @SerialName("year_from")
    val yearFrom: Int? = null,
    @SerialName("year_to")
    val yearTo: Int? = null,
    val limit: Int = 50,
)
