use crate::config::models::{Config, Destination, LoadMethod, StagingKind};
use crate::planning::models::LoadPath;
pub fn load_path(config: &Config, uses_key_pair: bool) -> LoadPath {
if let Destination::Databricks(_) = config.destination {
return match config.staging.kind {
StagingKind::None => LoadPath::Zerobus,
StagingKind::Internal => LoadPath::VolumeCopy,
StagingKind::S3 => LoadPath::S3Copy,
};
}
match (config.staging.kind, config.staging.load) {
(StagingKind::None, _) => LoadPath::Streaming,
(StagingKind::Internal, LoadMethod::Copy) => LoadPath::StageCopy,
(StagingKind::Internal, LoadMethod::Snowpipe) => LoadPath::StageInsertFiles,
(StagingKind::Internal, LoadMethod::Auto) if uses_key_pair => LoadPath::StageInsertFiles,
(StagingKind::Internal, LoadMethod::Auto) => LoadPath::StageCopy,
(StagingKind::S3, LoadMethod::Copy) => LoadPath::S3Copy,
(StagingKind::S3, _) if config.staging.s3.as_ref().is_some_and(|s3| s3.auto_ingest) => {
LoadPath::S3AutoIngest
}
(StagingKind::S3, LoadMethod::Snowpipe) => LoadPath::S3InsertFiles,
(StagingKind::S3, LoadMethod::Auto) if uses_key_pair => LoadPath::S3InsertFiles,
(StagingKind::S3, LoadMethod::Auto) => LoadPath::S3Copy,
}
}