//! Portable Athena pipeline contracts and request-domain helpers.
//!
//! This crate owns the declarative pipeline model that can be shared across the
//! server runtime, admin APIs, CLI/bootstrap loading, and future adapters
//! without depending on Actix or `AppState`.
//!
//! The current scope covers:
//!
//! - source/transform/sink pipeline DTOs,
//! - pipeline request payloads and template summaries,
//! - persisted template DTOs and record-to-runtime conversion helpers,
//! - pipeline template SQL adapters and step-log persistence helpers,
//! - request-independent pipeline execution orchestration behind runtime traits,
//! - database-backed template catalog loaders and list response contracts,
//! - YAML registry loading for named pipelines,
//! - validation and template/override resolution,
//! - template-name normalization and boot-template shadow policy helpers,
//! - gateway fetch-body construction and row alias rewriting.
//! - pipeline execution response contracts shared by runtime handlers and tests.

mod catalog;
mod contracts;
mod execution;
mod fetch;
mod persisted;
mod registry;
mod runner;
mod step_log;
mod template_store;
mod templates;

pub use catalog::{
    PipelineTemplateCatalogError, PipelineTemplateListResponse, load_pipeline_definition_map,
    load_pipeline_template_records, load_pipeline_template_summary_merge,
};
pub use contracts::{
    ConditionEntry, PipelineDefinition, PipelineRequest, SinkConfig, SourceConfig, TransformConfig,
};
pub use execution::{PipelineExecutionError, PipelineExecutionResponse};
pub use fetch::{apply_column_aliases, build_fetch_body};
pub use persisted::{
    PipelineTemplateRecord, SavePipelineTemplateRequest, pipeline_definition_map_from_records,
    runtime_template_candidates_from_records,
};
pub use registry::{
    load_registry_from_path, pipeline_definition_from_value, resolve_client_name,
    resolve_definition, validate_pipeline_definition,
};
pub use runner::{
    PipelineFetchFailure, PipelineRunContext, PipelineRunFetchFailure, PipelineRunOutcome,
    PipelineRunSuccess, PipelineRuntime, execute_pipeline_run,
};
pub use step_log::{
    PipelineStepLogEntry, ensure_pipeline_step_log_table, insert_pipeline_step_log,
};
pub use template_store::{
    delete_pipeline_template_by_name, ensure_pipeline_template_table,
    get_pipeline_template_by_name, list_pipeline_templates, upsert_pipeline_template,
};
pub use templates::{
    PipelineTemplateCandidate, PipelineTemplateSummary, PipelineTemplateSummaryMerge,
    build_template_summary, merge_template_summaries, normalize_pipeline_template_name,
    pipeline_template_name_conflicts_with_registry,
};
