use std::path::Path;

use indexmap::IndexMap;

use crate::parser::gitlab_fetch::GitlabConfig;

pub mod child;
mod extends;
pub(crate) mod func_cache;
mod pipeline;
mod variables;

pub use child::{resolve_child_job, resolve_child_pipeline};
pub use pipeline::{resolve_pipeline, resolve_pipeline_tolerant};
pub use variables::{GitContext, expand_vars};

/// Bundles the configuration needed to resolve GitLab pipelines and child pipelines.
pub struct ResolveContext<'a> {
    pub gitlab_config: Option<&'a GitlabConfig>,
    pub project_root: Option<&'a Path>,
    pub allow_unresolved: bool,
    pub git_context: &'a GitContext,
    pub var_overrides: &'a IndexMap<String, String>,
}
