use crate::adapters::files::main::table_path::table_path;
use crate::adapters::files::models::{FilesDestination, TablePath, TablePathRequest};
use crate::loader::models::TableSpec;
use crate::project::constants::DEFAULT_DESTINATION_PATH;
pub(in crate::loader) fn table_folder(
spec: &TableSpec,
destination: &FilesDestination,
) -> Result<TablePath, String> {
table_path(&TablePathRequest {
template: spec
.destination_path
.as_deref()
.unwrap_or(DEFAULT_DESTINATION_PATH),
connection: &destination.connection,
store: &destination.store,
source: &spec.source_name,
schema: &spec.source_table.schema,
table: &spec.source_table.name,
})
}