#![deny(warnings)]
#![allow(dead_code)]
// [TSM.ID].[11031972] -- All Rights Reserved. Proprietary & Confidential.
pub mod dvr;
pub mod scribe;
pub mod biometrics;
pub mod studio;
pub mod hologram;
pub mod cassandra;
pub mod inquisitor;
pub mod lazarus;
pub mod telepathy;

/// SDK version identifier
pub fn sdk_version() -> &'static str { "0.1.0-pxe" }

/// Validate S3 upload URL format
pub fn validate_upload_url(url: &str) -> Result<(), String> {
    if url.is_empty() { return Err("Empty URL".into()); }
    if !url.starts_with("https://") { return Err("Must use HTTPS".into()); }
    Ok(())
}

/// Calculate recording chunk size based on bitrate and interval
pub fn chunk_size_bytes(bitrate_kbps: u32, interval_ms: u32) -> u64 {
    (bitrate_kbps as u64 * interval_ms as u64) / 8
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_sdk_version() {
        assert!(!sdk_version().is_empty());
        assert!(sdk_version().contains("pxe"));
    }

    #[test]
    fn test_validate_url() {
        assert!(validate_upload_url("https://s3.amazonaws.com/bucket").is_ok());
        assert!(validate_upload_url("http://insecure.com").is_err());
        assert!(validate_upload_url("").is_err());
    }

    #[test]
    fn test_chunk_size() {
        // 2000 kbps * 1000ms / 8 = 250,000 bytes
        assert_eq!(chunk_size_bytes(2000, 1000), 250_000);
    }
}
