use std::fmt::{Debug, Formatter};

use crate::tree::ast::identifier::Identifier;
use crate::types::struct_type::Struct;

pub trait EnvironmentProvider: Debug + Send + Sync {
    fn reflect_columns(&self, name: &Identifier) -> anyhow::Result<Struct>;
    fn reflect_datasets(&self) -> anyhow::Result<Vec<Identifier>>;
}

#[derive(Default, Clone, Copy)]
pub struct NoOpProvider {}

impl Debug for NoOpProvider {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        write!(f, "NoOpProvider")
    }
}

impl EnvironmentProvider for NoOpProvider {
    fn reflect_columns(&self, _name: &Identifier) -> anyhow::Result<Struct> {
        Ok(Struct::default())
    }

    fn reflect_datasets(&self) -> anyhow::Result<Vec<Identifier>> {
        Ok(vec![])
    }
}
