use serde::{Deserialize, Serialize};

use super::downbeats::DownbeatsState;

/// Response from the /api/gen/{clip_id}/instruments endpoint
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Instruments {
    /// State of the instrument detection: "running", "error", "complete", or "streaming"
    pub state: DownbeatsState,

    /// Error message if state is "error"
    #[serde(skip_serializing_if = "Option::is_none")]
    pub error_message: Option<String>,

    /// Whether this is the final result
    #[serde(skip_serializing_if = "Option::is_none")]
    pub r#final: Option<bool>,

    /// List of detected instrument names
    #[serde(skip_serializing_if = "Option::is_none")]
    pub instruments: Option<Vec<String>>,

    /// List of instrument groups
    #[serde(skip_serializing_if = "Option::is_none")]
    pub groups: Option<Vec<String>>,
}
