use ascii_dag::graph::DAG;

fn main() {
    println!("\n=== Git History Visualization ===\n");

    let mut dag = DAG::new();

    // Key: 1=Initial, 2=Feat, 3=Fix, 4=Merge
    // Topology:
    // 1 -> 2 (Feature Branch)
    // 1 -> 3 (Main Branch Fix)
    // 2 -> 4 (Merge)
    // 3 -> 4 (Merge)

    dag.add_node(1, "Initial Commit (a1b2c)");
    dag.add_node(2, "Feat: Login (d4e5f)");
    dag.add_node(3, "Fix: Typos (g7h8i)");
    dag.add_node(4, "Merge branch 'feat/login' (j9k0l)");
    dag.add_node(5, "Release v1.0 (m1n2o)");

    dag.add_edge(1, 2);
    dag.add_edge(1, 3);
    dag.add_edge(2, 4);
    dag.add_edge(3, 4);
    dag.add_edge(4, 5);

    println!("{}", dag.render());

    println!("\n=== Complex Branching ===\n");
    // Diverge -> Diverge -> Converge
    let mut complex = DAG::new();
    complex.add_node(10, "init");
    complex.add_node(11, "dev");
    complex.add_node(12, "feature-A");
    complex.add_node(13, "feature-B");
    complex.add_node(14, "dev-update");
    complex.add_node(15, "merge-A");
    complex.add_node(16, "merge-all");

    // init -> dev
    complex.add_edge(10, 11);

    // dev splits into A, B, and continues
    complex.add_edge(11, 12); // dev -> feature-A
    complex.add_edge(11, 13); // dev -> feature-B
    complex.add_edge(11, 14); // dev -> dev-update

    // A merges back to dev
    complex.add_edge(12, 15);
    complex.add_edge(14, 15);

    // B and A-Merge merge to final
    complex.add_edge(13, 16);
    complex.add_edge(15, 16);

    println!("{}", complex.render());
}
