// Generated at build time from site/i18n, site/config/menus, site/config/themes.
// Struct name matches the first arg passed to `generate_resource_contributor_code`
// in build.rs — change both together if you rename it.
include!(concat!(env!("OUT_DIR"), "/resource_contributor.rs"));

/// Register all site resources and the SSR shell renderer.
///
/// Must be called before `run_server()` starts accepting requests.
pub fn initialize() -> Result<(), Box<dyn std::error::Error>> {
    // Register this implementation's shell so all SSR responses use it.
    rustelo_server::run::register_shell_renderer(crate::run::render_ssr_with_context);

    // Register the generated contributor (menus, footers, themes, FTL).
    rustelo_core_lib::register_contributor(&SiteResourceContributor)?;

    // Load registered resources into the runtime registries.
    rustelo_core_lib::load_resources_from_config()?;

    Ok(())
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn contributor_is_instantiable() {
        let _c = SiteResourceContributor;
    }
}
