pub mod mongosh;
pub mod mysql;
pub mod prisma;
pub mod redis;

use forge::signal::compactor;

pub fn compress_psql(raw: &str) -> String {
    let cleaned = compactor::normalise(raw);
    compactor::collapse_blanks(&cleaned)
}

/// Route database tool output to the right compressor.
pub fn compress_db(prog: &str, subcmd: &str, raw: &str) -> String {
    match prog {
        "mysql" | "mariadb" | "mycli" => mysql::compress_mysql(raw),
        "mysqldump" => mysql::compress_mysqldump(raw),
        "prisma" => prisma::compress_prisma(subcmd, raw),
        "mongosh" | "mongo" => mongosh::compress_mongosh(raw),
        "redis-cli" | "redis" => redis::compress_redis(raw),
        _ => compress_psql(raw),
    }
}
