use serde::{Deserialize, Serialize};
use std::fmt;

/// Supported data source types across the Skardi provider layer.
#[derive(Debug, Clone, Copy, Deserialize, Serialize, Hash, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
pub enum DataSourceType {
    Csv,
    Parquet,
    Postgres,
    Mysql,
    Sqlite,
    Iceberg,
    Mongo,
    Redis,
    Lance,
    Seekdb,
}

impl DataSourceType {
    pub fn as_str(&self) -> &'static str {
        match self {
            Self::Csv => "csv",
            Self::Parquet => "parquet",
            Self::Postgres => "postgres",
            Self::Mysql => "mysql",
            Self::Sqlite => "sqlite",
            Self::Iceberg => "iceberg",
            Self::Mongo => "mongo",
            Self::Redis => "redis",
            Self::Lance => "lance",
            Self::Seekdb => "seekdb",
        }
    }
}

impl fmt::Display for DataSourceType {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        f.write_str(self.as_str())
    }
}
