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

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

@Serializable
data class TtsCreateRequest(
    @SerialName("book_id")
    val bookId: String,
    val engine: String = "silero",
    @SerialName("voice_id")
    val voiceId: String = "",
    val speed: Double = 1.0,
)

@Serializable
data class TtsJobResponse(
    @SerialName("job_id")
    val jobId: String,
    @SerialName("book_id")
    val bookId: String,
    val title: String = "",
    val author: String = "",
    val engine: String = "",
    @SerialName("voice_id")
    val voiceId: String = "",
    val speed: Double = 1.0,
    val status: String = "",
    val progress: Double = 0.0,
    @SerialName("current_chapter")
    val currentChapter: String = "",
    @SerialName("total_chapters")
    val totalChapters: Int = 0,
    @SerialName("completed_chapters")
    val completedChapters: Int = 0,
    @SerialName("output_path")
    val outputPath: String = "",
    val error: String = "",
    @SerialName("created_at")
    val createdAt: Double = 0.0,
    @SerialName("started_at")
    val startedAt: Double = 0.0,
    @SerialName("completed_at")
    val completedAt: Double = 0.0,
)

@Serializable
data class TtsJobsResponse(
    val jobs: List<TtsJobResponse> = emptyList(),
)

@Serializable
data class TtsEnginesResponse(
    val engines: List<TtsEngineResponse> = emptyList(),
)

@Serializable
data class TtsVoicesResponse(
    val voices: List<TtsVoiceResponse> = emptyList(),
)

@Serializable
data class TtsEngineResponse(
    val id: String,
    val name: String,
    val capabilities: TtsEngineCapabilitiesResponse,
)

@Serializable
data class TtsEngineCapabilitiesResponse(
    @SerialName("supports_streaming")
    val supportsStreaming: Boolean = false,
    @SerialName("supports_cloning")
    val supportsCloning: Boolean = false,
    @SerialName("max_text_length")
    val maxTextLength: Int = 5000,
    @SerialName("needs_network")
    val needsNetwork: Boolean = false,
)

@Serializable
data class TtsVoiceResponse(
    val id: String,
    val name: String,
    val language: String,
    val engine: String,
    val gender: String = "",
    val quality: String = "",
    @SerialName("requires_reference")
    val requiresReference: Boolean = false,
)
