use std::io;
use std::path::Path;
use crate::formulas::FormulaFactory;
use crate::io::{read_formula, write_formula};
use crate::operations::transformations::Anonymizer;
pub fn anonymize_file(path: &Path, export_path: &Path, var_prefix: &str) -> io::Result<()> {
let f = FormulaFactory::new();
let formula = read_formula(path.to_str().unwrap(), &f)?;
let mut anon = Anonymizer::with_prefix(var_prefix, &f);
let transformed = anon.anonymize(formula);
write_formula(export_path.to_str().unwrap(), transformed, &f)
}
pub fn anonymize_file_with_anonymizer(path: &Path, export_path: &Path, anonymizer: &mut Anonymizer) -> io::Result<()> {
let formula = read_formula(path.to_str().unwrap(), anonymizer.factory)?;
let transformed = anonymizer.anonymize(formula);
write_formula(export_path.to_str().unwrap(), transformed, anonymizer.factory)
}