use std::sync::Arc;
use sqruff_lib_core::errors::SQLFluffUserError;
use sqruff_lib_core::templaters::TemplatedFile;
use crate::Formatter;
use crate::core::config::FluffConfig;
use crate::templaters::placeholder::PlaceholderTemplater;
use crate::templaters::raw::RawTemplater;
#[cfg(feature = "python")]
use crate::templaters::jinja::JinjaTemplater;
#[cfg(feature = "python")]
use crate::templaters::python::PythonTemplater;
#[cfg(feature = "python")]
pub mod dbt;
#[cfg(feature = "python")]
pub mod jinja;
pub mod placeholder;
#[cfg(feature = "python")]
pub mod python;
#[cfg(feature = "python")]
pub mod python_shared;
pub mod raw;
pub mod types;
pub use types::{PlaceholderStyle, TemplaterKind};
pub static RAW_TEMPLATER: RawTemplater = RawTemplater;
pub static PLACEHOLDER_TEMPLATER: PlaceholderTemplater = PlaceholderTemplater;
#[cfg(feature = "python")]
pub static PYTHON_TEMPLATER: PythonTemplater = PythonTemplater;
#[cfg(feature = "python")]
pub static JINJA_TEMPLATER: JinjaTemplater = JinjaTemplater;
#[cfg(feature = "python")]
pub static DBT_TEMPLATER: dbt::DBTTemplater = dbt::DBTTemplater;
#[cfg(feature = "python")]
pub static TEMPLATERS: [&'static dyn Templater; 5] = [
&RAW_TEMPLATER,
&PLACEHOLDER_TEMPLATER,
&PYTHON_TEMPLATER,
&JINJA_TEMPLATER,
&DBT_TEMPLATER,
];
#[cfg(not(feature = "python"))]
pub static TEMPLATERS: [&'static dyn Templater; 2] = [&RAW_TEMPLATER, &PLACEHOLDER_TEMPLATER];
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ProcessingMode {
Parallel,
Sequential,
Batch,
}
pub trait Templater: Send + Sync {
fn name(&self) -> &'static str;
fn description(&self) -> &'static str;
fn processing_mode(&self) -> ProcessingMode;
fn process(
&self,
files: &[(&str, &str)],
config: &FluffConfig,
formatter: &Option<Arc<dyn Formatter>>,
) -> Vec<Result<TemplatedFile, SQLFluffUserError>>;
}