//! Macro `urlpatterns!` — declares named routes and registers them in the global registry.

pub use crate::macros::routeur::register_url::{
    add_urls, register_name_url, register_pending, reverse, reverse_with_parameters,
};

#[macro_export]
macro_rules! urlpatterns {
    (
        $($path:expr => $handler:expr, name = $name:expr) ,* $(,)?
    ) => {{
        let mut router = $crate::axum::Router::new();

        $(
            $crate::macros::routeur::register_url::register_pending($name, $path);

            router = router.route($path, $handler);
        )*
        router
    }};

    (
        $($path:expr => $handler:expr) ,* $(,)?
    ) => {{
        let mut router = $crate::axum::Router::new();

        $(
            router = router.route($path, $handler);
        )*
        router
    }};
}
