/**
 * Shared runtime constants used by the frontend UI.
 */
import type { BanOriginFilter, TimeRange } from "../types/ban";

// ---------------------------------------------------------------------------
// UI Constants
// ---------------------------------------------------------------------------

export const BAN_ORIGIN_FILTER_LABELS: Record<BanOriginFilter, string> = {
  all: "All",
  blocklist: "Blocklist",
  selfblock: "Selfblock",
} as const;

export const TIME_RANGE_LABELS: Record<TimeRange, string> = {
  "24h": "Last 24 h",
  "7d": "Last 7 days",
  "30d": "Last 30 days",
  "365d": "Last 365 days",
} as const;

/** Items per page for the ban dashboard table. */
export const BAN_PAGE_SIZE = 100 as const;

/** Items per page for the history table. */
export const HISTORY_PAGE_SIZE = 50 as const;

// ---------------------------------------------------------------------------
// Storage Keys
// ---------------------------------------------------------------------------

/** SessionStorage key for authentication state persistence. */
export const STORAGE_KEY_AUTHENTICATED = "bangui_authenticated" as const;

/** LocalStorage key for sidebar collapsed state. */
export const STORAGE_KEY_SIDEBAR_COLLAPSED = "bangui_sidebar_collapsed" as const;

/** LocalStorage key for theme preference. */
export const STORAGE_KEY_THEME = "bangui_theme" as const;

// ---------------------------------------------------------------------------
// Security
// ---------------------------------------------------------------------------

/** CSRF header name - must match backend/app/utils/constants.py CSRF_HEADER_NAME. */
export const CSRF_HEADER_NAME = "X-BanGUI-Request" as const;

/** CSRF header required value - must match backend/app/utils/constants.py CSRF_HEADER_VALUE. */
export const CSRF_HEADER_VALUE = "1" as const;
