/**
 * TypeScript types for the world-map / bans-by-country API.
 */

import type { TimeRange } from "./ban";

/** Time-range preset for filtering queries. */
export type { TimeRange };

/** A single enriched ban item as returned by the by-country endpoint. */
export interface MapBanItem {
  ip: string;
  jail: string;
  banned_at: string;
  service: string | null;
  country_code: string | null;
  country_name: string | null;
  asn: string | null;
  org: string | null;
  ban_count: number;
  /** Whether this ban came from a blocklist import or fail2ban itself. */
  origin: "blocklist" | "selfblock";
}

/** Response from GET /api/dashboard/bans/by-country */
export interface BansByCountryResponse {
  /** ISO alpha-2 country code → ban count */
  countries: Record<string, number>;
  /** ISO alpha-2 country code → human-readable country name */
  country_names: Record<string, string>;
  /** All individual ban records in the window (up to server limit) */
  bans: MapBanItem[];
  /** Total ban count in the window */
  total: number;
}
