use std::sync::Arc;

use crate::collections::LinearMap;
use crate::core::router::handlers::{ErasedLayoutComponent, ErasedPageComponent, ErasedErrorComponent, ErasedLoaderComponent};
use crate::core::router::utils::Path;

#[derive(Clone)]
pub enum ParallelRouteNode {
    Page {
        path: Path,
        controller: Option<Arc<dyn ErasedPageComponent>>,
        error_controller: Option<Arc<dyn ErasedErrorComponent>>,
        loader_controller: Option<Arc<dyn ErasedLoaderComponent>>,
        children: Vec<ParallelRouteNode>,
    },

    Layout {
        id: String,
        controller: Option<Arc<dyn ErasedLayoutComponent>>,
        error_controller: Option<Arc<dyn ErasedErrorComponent>>,
        loader_controller: Option<Arc<dyn ErasedLoaderComponent>>,
        parallel_routes: LinearMap<String, Vec<ParallelRouteNode>>, 
        children: Vec<ParallelRouteNode>,
    }
}