//! URL path constants and builders.
//!
//! Centralising these catches routing refactors at compile time (a
//! rename to the constant/fn shows up in every test file in one
//! `cargo check`) rather than as a scatter of 404s.
//!
//! The public `/api/*` surface lives in `doctate_common` and is
//! re-exported from there (see `ONELINERS_PATH`, `UPLOAD_PATH`).

pub use doctate_common::{ONELINERS_PATH, UPLOAD_PATH};

// -- /web/* --

/// `POST /web/login` — form login (slug, password).
pub const LOGIN: &str = "/web/login";
/// `POST /web/logout` — CSRF-protected logout.
pub const LOGOUT: &str = "/web/logout";
/// `GET /web/cases` — case list; also triggers the lazy retention sweep.
pub const CASES: &str = "/web/cases";
/// `POST /web/cases/bulk` — admin bulk action (close/analyze/reset).
pub const BULK: &str = "/web/cases/bulk";
/// `POST /web/cases/purge-closed` — admin hard-delete of closed cases.
pub const PURGE_CLOSED: &str = "/web/cases/purge-closed";
/// `GET /web/events` — SSE stream (per-user scoped).
pub const EVENTS: &str = "/web/events";

// -- per-case builders --

/// `/web/cases/{case_id}`.
pub fn case_detail(case_id: &str) -> String {
    format!("/web/cases/{case_id}")
}

/// `/web/cases/{case_id}/recordings`.
pub fn case_recordings(case_id: &str) -> String {
    format!("/web/cases/{case_id}/recordings")
}

/// `POST /web/cases/{case_id}/close`.
pub fn case_close(case_id: &str) -> String {
    format!("/web/cases/{case_id}/close")
}

/// `POST /web/cases/{case_id}/reopen`.
pub fn case_reopen(case_id: &str) -> String {
    format!("/web/cases/{case_id}/reopen")
}

/// `POST /web/cases/{case_id}/analyze`.
pub fn case_analyze(case_id: &str) -> String {
    format!("/web/cases/{case_id}/analyze")
}

/// `POST /web/cases/{case_id}/reset` — admin-only hard-reset.
pub fn case_reset(case_id: &str) -> String {
    format!("/web/cases/{case_id}/reset")
}

/// `POST /web/cases/{case_id}/recordings/delete` — per-recording delete.
pub fn recording_delete(case_id: &str) -> String {
    format!("/web/cases/{case_id}/recordings/delete")
}

/// `POST /web/cases/{case_id}/oneliner` — session-authenticated manual
/// oneliner override (browser web UI).
pub fn case_oneliner_web(case_id: &str) -> String {
    format!("/web/cases/{case_id}/oneliner")
}

/// `GET /web/magic?token={token}` — magic-link consumption.
pub fn magic(token: &str) -> String {
    format!("/web/magic?token={token}")
}
