zinzen 0.3.0

Algorithm for auto-scheduling time-constrained tasks on a timeline
extern crate scheduler;

use std::env;

use scheduler::run_scheduler;
use scheduler::technical::input_output::{self, Input};

/// Development harness: run the scheduler on a single input JSON file.
///
/// The fixture path can be passed as the first CLI argument; it defaults to the
/// algorithm-challenge fixture. Uses the canonical `Input` type so it can never
/// drift from the library's own input schema (improvement-plan P1-5).
fn main() {
    let path = env::args()
        .nth(1)
        .unwrap_or_else(|| "./tests/jsons/stable/algorithm-challenge/input.json".to_string());
    scheduler::log_debug!("Running scheduler on {path}");

    let input: Input =
        input_output::get_input_from_json(&path).expect("input JSON should exist and be valid");
    scheduler::log_dbg!(&input);

    match run_scheduler(&input) {
        // Names are underscore-prefixed so they stay warning-free when the
        // with-logging feature (and thus the macro body) is compiled out.
        Ok(_result) => scheduler::log_dbg!(&_result),
        Err(_error) => scheduler::log_debug!("scheduler error: {_error}"),
    }
}