//! HTML page routes, split by domain.
mod blog;
pub(crate) mod dashboard;
mod email_actions;
mod feeds;
pub(crate) mod public;
mod sandbox;
use crate::{AppState, csrf::CsrfRouter};
use axum::Router;
/// Compose the page tree from posture-declared sub-groups and `finalize()` once.
///
/// Every sub-router is a `CsrfRouter`, and `CsrfRouter::merge` only accepts
/// another `CsrfRouter`, so a bare `axum::Router` (which can carry an
/// undeclared mutation route) is a *type error* here, not a silent CSRF bypass.
/// A group merged as a bare `Router` (`email_actions`, `sandbox`, `feeds`,
/// `blog`) skips the envelope, and its mutation routes go unprotected.
/// `finalize()` drops the wrapper exactly once, here.
pub fn page_routes(limits: crate::constants::RateLimits) -> Router {
CsrfRouter::new()
.merge(public::public_routes(limits))
.merge(sandbox::sandbox_routes(limits))
.merge(dashboard::dashboard_routes())
.merge(email_actions::email_action_routes(limits))
.merge(feeds::feed_routes())
.merge(blog::blog_routes())
.finalize()
}