//! UI-visible application state.
//!
//! The state machine here only reflects **user intent** — "ready to
//! record", "recording in progress", "config error, please fix".
//! Background activity (upload queue, poll cycle, finalize flush) lives
//! in a separate observable layer — see
//! `doctate_client_core::footer_status`.

use std::time::Instant;

use uuid::Uuid;

#[derive(Debug)]
pub enum AppState {
    /// No valid config on disk — show settings panel.
    NotConfigured,
    /// Ready for a new recording. No ephemeral context.
    Idle,
    /// ffmpeg is actively capturing audio.
    Recording {
        case_id: Uuid,
        recorded_at: String,
        started_at: Instant,
    },
    /// Terminal error; user must dismiss or fix config.
    Error { message: String },
}

impl AppState {
    pub fn label(&self) -> &'static str {
        match self {
            Self::NotConfigured => "Konfiguration fehlt",
            Self::Idle => "Bereit",
            Self::Recording { .. } => "Aufnahme läuft",
            Self::Error { .. } => "Fehler",
        }
    }
}
