use dioxus::prelude::*;

use crate::components::app_shell::AppShell;
use crate::pages::*;

#[derive(Debug, Clone, Routable, PartialEq)]
#[rustfmt::skip]
#[allow(clippy::enum_variant_names)]
pub enum Route {
    #[layout(AppShell)]
        #[route("/")]
        OverviewPage {},
        #[route("/targets")]
        TargetsPage {},
        #[route("/onboard")]
        OnboardingPage {},
        #[route("/findings")]
        FindingsPage {},
        #[route("/findings/:id")]
        FindingDetailPage { id: String },
        #[route("/sbom")]
        SbomPage {},
        #[route("/issues")]
        IssuesPage {},
        #[route("/graph")]
        GraphIndexPage {},
        #[route("/graph/:repo_id")]
        GraphExplorerPage { repo_id: String },
        #[route("/graph/:repo_id/impact/:finding_id")]
        ImpactAnalysisPage { repo_id: String, finding_id: String },
        #[route("/chat")]
        ChatIndexPage {},
        #[route("/chat/:repo_id")]
        ChatPage { repo_id: String },
        #[route("/dast")]
        DastOverviewPage {},
        #[route("/dast/targets")]
        DastTargetsPage {},
        #[route("/dast/findings")]
        DastFindingsPage {},
        #[route("/dast/findings/:id")]
        DastFindingDetailPage { id: String },
        #[route("/pentest")]
        PentestDashboardPage {},
        #[route("/pentest/:session_id")]
        PentestSessionPage { session_id: String },
        #[route("/mcp-servers")]
        McpServersPage {},
        #[route("/mcp-tokens")]
        McpTokensPage {},
}

const FAVICON: Asset = asset!("/assets/favicon.svg");
const MAIN_CSS: Asset = asset!("/assets/main.css");
const TAILWIND_CSS: Asset = asset!("/assets/tailwind.css");
const VIS_NETWORK_JS: Asset = asset!("/assets/vis-network.min.js");
const GRAPH_VIZ_JS: Asset = asset!("/assets/graph-viz.js");
#[component]
pub fn App() -> Element {
    rsx! {
        document::Link { rel: "icon", href: FAVICON }
        document::Link { rel: "stylesheet", href: TAILWIND_CSS }
        document::Link { rel: "stylesheet", href: MAIN_CSS }
        document::Script { src: VIS_NETWORK_JS }
        document::Script { src: GRAPH_VIZ_JS }
        Router::<Route> {}
    }
}
