use archetype_asset::cache::AssetCache;
use archetype_asset::gpu::mock::MockGpu;
use archetype_asset::runtime::TokioSpawner;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // Note: Creating a real LOD demo requires a real window to visualize,
    // or at least verifying the mesh data properties.
    // Since we are headless in this environment, we will demonstrate the setup
    // and inspection of LOD levels.

    println!("LOD Generation Demo");

    // Enable LOD feature in Cargo.toml for this to work effectively
    // (This example assumes the library is compiled with 'lod' feature)

    let gpu = MockGpu::new();
    let spawner = TokioSpawner::new();
    let cache = AssetCache::new(gpu, spawner, 500 * 1024 * 1024);

    // In a real app, you would load a high-poly mesh.
    // cache.get_or_load_model(...) would automatically generate LODs
    // if configured in the loader (ModelLoader::default() uses MeshoptSimplifier if enabled).

    println!("Note: This demo requires a valid GLB file to demonstrate actual simplification.");
    println!("In a real scenario, you would inspect:");
    println!("  let model = cache.get_or_load_model(\"high_poly.glb\").await?;");
    println!("  for (i, lod) in model.lods.iter().enumerate() {{");
    println!("      println!(\"LOD {{}}: {{}} vertices\", i, lod.vertex_count());");
    println!("  }}");

    // Here we just verify the system initializes
    let _ = cache;
    println!("LOD System initialized.");

    Ok(())
}
