mod renderer;

use renderer::prelude::*;

// Add these to Cargo.toml:
// [dependencies]
// image = "0.24"
// imageproc = "0.23"
// gstreamer = "0.21"
// gstreamer-app = "0.21"

// Configuration struct for rendering settings

// Color representation

// Easing functions for animations

// Animation structure

// Drawable item that exists on a layer

// Scene represents a collection of drawables and animations for a duration

pub fn create_example_video() -> Vec<Task> {
    vec![
        Task::SetConfig(Config {
            width: 800,
            height: 600,
            background_color: Color::new(20, 20, 30, 255),
            fps: 30.0,
            num_layers: 5,
        }),
        Task::MoveToLayer(0),
        Task::Draw(Element::Rectangle(RectangleElement::new(
            Point::new(100.0, 100.0),
            Size::new(200.0, 150.0),
            Color::new(255, 100, 100, 255),
            true,
            0.0,
        ))),
        Task::MoveToLayer(1),
        Task::Draw(Element::Circle(CircleElement::new(
            Point::new(400.0, 300.0),
            50.0,
            Color::new(100, 255, 100, 255),
            false,
            3.0,
        ))),
        Task::Draw(Element::Line(LineElement::new(
            Point::new(50.0, 50.0),
            Point::new(750.0, 550.0),
            Color::new(255, 255, 100, 255),
            5.0,
        ))),
        Task::RenderScene(5.0),
        Task::MoveToLayer(0),
        Task::Animate(Animation::new(
            Element::Rectangle(RectangleElement::new(
                Point::new(100.0, 100.0),
                Size::new(200.0, 150.0),
                Color::new(255, 100, 100, 255),
                true,
                0.0,
            )),
            Element::Rectangle(RectangleElement::new(
                Point::new(500.0, 350.0),
                Size::new(100.0, 100.0),
                Color::new(100, 100, 255, 255),
                true,
                0.0,
            )),
            3.0,
            EasingFunction::EaseInOut,
        )),
        Task::MoveToLayer(2),
        Task::Animate(Animation::new(
            Element::Circle(CircleElement::new(
                Point::new(400.0, 300.0),
                50.0,
                Color::new(100, 255, 100, 255),
                false,
                3.0,
            )),
            Element::Circle(CircleElement::new(
                Point::new(200.0, 150.0),
                100.0,
                Color::new(255, 150, 50, 255),
                true,
                0.0,
            )),
            3.0,
            EasingFunction::Bounce,
        )),
        Task::RenderScene(3.0),
    ]
}

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Example usage
    let mut renderer = VideoRenderer::new();
    let tasks = create_example_video();

    renderer.process_tasks(tasks);

    let info = renderer.export_info();
    println!("Video Info: {:?}", info);

    // Render the complete video
    renderer.render_to_video("output.mp4")?;

    Ok(())
}
