use std::time::Duration;

use fiscalprinter::{FiscalPrinter, ReportType, Report, ReportAction};
mod pnp;

fn main() {


    // // Configure the database
    // let mut cfg = Config::new("./printer_config");

    // // Open the key/value store
    // let store = Store::new(cfg).expect("Error opening config file");

    // // A Bucket provides typed access to a section of the key/value store
    // let test = store.bucket::<Raw, Raw>(Some("test")).expect("Error writting config file");

    // let key = Raw::from(b"test");
    // let value = Raw::from(b"123");

    // // Set test = 123
    // test.set(&key, &value).expect("Error writting value for config file");
    // assert!(test.get(&key).unwrap().unwrap() == value);
    // assert!(test.get(&b"something else".into()).unwrap() == None);




    let mut _handler = serialport::new("/dev/ttyUSB0", 9600)
            .timeout(Duration::from_millis(10))
        .open().expect("Failed to open port");
    let mut _pnp_driver: pnp::printer::Printer = FiscalPrinter::new();
    
    let _x_result = _pnp_driver.print_report(&mut _handler, Report::new(ReportType::XReport));

    println!("Result of X Report {:?}", _x_result);

}
