use std::sync::{Arc, atomic::AtomicU64};

/// Minimal configuration carried into the probe / direct-reader path.
#[derive(Default)]
pub(crate) struct SymphoniaConfig {
    /// Handle for dynamic byte length updates (HLS).
    pub(crate) byte_len_handle: Option<Arc<AtomicU64>>,
    /// File extension hint for Symphonia probe (e.g., `"mp3"`, `"aac"`).
    ///
    /// Used by the probe path when no container is known up-front.
    pub(crate) hint: Option<String>,
    /// Enable gapless trim wiring through the Symphonia decoder.
    ///
    /// When `true`, [`SymphoniaCodec::open_with_config`](super::codec::SymphoniaCodec::open_with_config)
    /// flips `AudioDecoderOptions::gapless = true` so codecs that
    /// internally trim (FLAC/Opus/Vorbis) honour it. MP3 priming is
    /// applied separately via
    /// [`crate::codec::FrameCodec::decoder_algo_delay`].
    pub(crate) gapless: bool,
}

#[cfg(test)]
mod tests {
    use kithara_test_utils::kithara;

    use super::*;

    #[kithara::test]
    fn test_symphonia_config_default() {
        let config = SymphoniaConfig::default();
        assert!(config.byte_len_handle.is_none());
        assert!(config.hint.is_none());
        assert!(!config.gapless);
    }

    #[kithara::test]
    fn test_symphonia_config_with_hint() {
        let config = SymphoniaConfig {
            hint: Some("mp3".into()),
            ..Default::default()
        };
        assert_eq!(config.hint, Some("mp3".into()));
    }

    #[kithara::test]
    fn test_symphonia_config_with_gapless() {
        let config = SymphoniaConfig {
            gapless: true,
            ..Default::default()
        };
        assert!(config.gapless);
    }
}
