use vdir::transport::dir::dir_transport::DirTransport;
use vdir::transport::dir::file::DirFileTransport;
use vfile::transport::seekable::file::SeekableFileTransport;
use vfile::transport::seekable::seekable_transport::SeekableTransport;
use vfile::transport::streaming::file::FileTransport;
use vfile::transport::streaming::http::HttpTransport;
use vfile::transport::streaming::streaming_transport::StreamingTransport;

use crate::source::csv_input_config::CSVInputConfig;
use crate::source::csv_source_factory::CSVSourceFactory;
use crate::source::dc_source_factory::DCSourceFactory;
use crate::source::source_factory::ChopperSourceFactory;
use crate::util::dc_factory::DCFactory;

pub fn create_default_source_factories(
    dc_factory: Option<DCFactory>,
    csv_input_config: Option<CSVInputConfig>,
) -> Vec<Box<ChopperSourceFactory>> {
    let mut source_factories: Vec<Box<ChopperSourceFactory>> = Vec::new();
    if let Some(csv_input_config) = csv_input_config {
        source_factories.push(Box::new(CSVSourceFactory::new(csv_input_config)));
    }
    if let Some(dc_factory) = dc_factory {
        source_factories.push(Box::new(DCSourceFactory::new(dc_factory)));
    }
    source_factories
}

pub fn create_default_dir_transports() -> Vec<Box<dyn DirTransport>> {
    vec![Box::new(DirFileTransport)]
}

pub fn create_default_seekable_transports() -> Vec<Box<dyn SeekableTransport>> {
    vec![Box::new(SeekableFileTransport)]
}

pub fn create_default_streaming_transports() -> Vec<Box<dyn StreamingTransport>> {
    vec![Box::new(FileTransport), Box::new(HttpTransport)]
}
