pub mod adapter;
pub mod ingest;
pub mod normalize;
pub mod parse;
pub mod price;
pub mod read;
pub mod sources;
pub mod tax_tables;
pub use adapter::{Adapter, FileGroup, FileReport, GroupOutput, IngestBatch, SourceFile};
pub use ingest::{ingest_files, ingest_files_bundled};
pub use price::{BundledPrices, LayeredPrices};
pub use tax_tables::BundledTaxTables;
#[derive(Debug, thiserror::Error)]
pub enum AdapterError {
#[error("io reading {path}: {source}")]
Io {
path: String,
#[source]
source: std::io::Error,
},
#[error("csv {path}: {source}")]
Csv {
path: String,
#[source]
source: csv::Error,
},
#[error("xlsx {path}: {source}")]
Xlsx {
path: String,
#[source]
source: calamine::Error,
},
#[error("xlsx {path}: no worksheet found")]
EmptyXlsx { path: String },
#[error("{adapter} row {line}: missing required column {column:?}")]
MissingColumn {
adapter: &'static str,
line: usize,
column: String,
},
#[error("{adapter} row {line}: cannot parse {field} from {value:?}: {reason}")]
Parse {
adapter: &'static str,
line: usize,
field: &'static str,
value: String,
reason: String,
},
#[error("unrecognized file (no adapter matched): {path}")]
UnknownSource { path: String },
#[error(
"unrecognized Swan file role (header did not match trades/transfers/withdrawals): {path}"
)]
UnrecognizedSwanRole { path: String },
#[error("{adapter}: header signature not found in file")]
HeaderNotFound { adapter: &'static str },
#[error("price dataset: {0}")]
PriceDataset(String),
}