//! OpenAPI documentation configuration using utoipa.

use utoipa::OpenApi;

use crate::db::models::{
    CreateFileRequest, File, FileListResponse, FileSummary, TranscriptEntry, UpdateFileRequest,
};
use crate::server::handlers::{files, listen};
use crate::server::messages::{ApiError, AudioEncoding, StartMessage, StopMessage, TranscriptMessage};

#[derive(OpenApi)]
#[openapi(
    info(
        title = "Makima API",
        version = "1.0.0",
        description = "Streaming audio APIs for speech-to-text with persistence.",
        license(name = "MIT"),
    ),
    paths(
        listen::websocket_handler,
        files::list_files,
        files::get_file,
        files::create_file,
        files::update_file,
        files::delete_file,
    ),
    components(
        schemas(
            ApiError,
            AudioEncoding,
            StartMessage,
            StopMessage,
            TranscriptMessage,
            // File schemas
            File,
            FileSummary,
            FileListResponse,
            CreateFileRequest,
            UpdateFileRequest,
            TranscriptEntry,
        )
    ),
    tags(
        (name = "Listen", description = "Speech-to-text streaming endpoints"),
        (name = "Files", description = "Transcript file management"),
    )
)]
pub struct ApiDoc;
