#![allow(unused_imports)]
use std::time::SystemTime;
use time::{
Duration,
OffsetDateTime,
};
use countries::*;
use fred_api::Fred;
use keytree::serialize::IntoKeyTree;
use countries::Country;
use ui_data::DataType;
use ui_data::*;
use ui_data::ts::*;
// use ui_data::ui::*;
use ui_data::fred::*;
pub fn main() {
let root_dir = shellexpand::tilde("~/currency.engineering/contents/data");
// Step 1
// println!("{}", DataSelector::from_file("interest_rate_selector.keytree")
// .into_data_spec()
// .unwrap()
// .keytree());
// println!("{}", DataSelector::from_file("austria_selector.keytree")
// .into_data_spec()
// .unwrap()
// .keytree());
// (paste this)
// Step 2
let data_spec = DataSpec::from_file(&format!("{}/source_data.keytree", root_dir)).unwrap();
// data_spec.update_write(&root_dir).unwrap();
data_spec
.update_write(&root_dir)
.unwrap();
// Step 3
// println!("{}", data_spec.generic_ts_spec().keytree());
// (paste this)
// Step 4
// let ts_spec = ts::Spec::from_file("ts_spec.keytree").unwrap();
// println!("{}", ts_spec.keytree());
// ts_spec.into_json(&root_dir).unwrap().into_ts_data().unwrap();
// let ts_data = TSData::from_spec(&ts_spec, &root_dir).unwrap();
// dbg!(&ts_data);
// Fred::series_observations("AUSURTOTMDSMEI").unwrap();
// JSON does have "." as first value. What should we do? drop_until_parsable ? Or just define
// dates?
// We have to know where the parsing happens.
// It happens in "TimeSeries::<1>::from_csv(&path)"
// Step 5
// let ui_spec = ui::Spec::from_file("ui_spec.keytree").unwrap();
// ui_spec.into_json(&root_dir).unwrap().into_ts_data().unwrap();
}