import {
  FileText, ShieldAlert, DollarSign, Users, MessageCircle,
  Shield, Activity, CheckSquare, FolderOpen, Bell,
  Megaphone, CreditCard, Inbox, BarChart3, TrendingUp,
  CalendarClock, Layers, FileCheck, Megaphone as MegaphoneIcon, type LucideIcon
} from "lucide-react";

export type CardType = "stat" | "chart" | "table" | "quick_action" | "status_updates";

export interface CardDefinition {
  id: string;
  type: CardType;
  title: string;
  description: string;
  icon: LucideIcon;
  defaultW: number;
  defaultH: number;
  minW: number;
  minH: number;
  maxW?: number;
  maxH?: number;
}

export const CARD_CATALOG: CardDefinition[] = [
  // ── Stat/KPI Cards ──
  { id: "stat_pending_arc", type: "stat", title: "Pending ARC", description: "Applications awaiting review", icon: FileText, defaultW: 2, defaultH: 2, minW: 2, minH: 2 },
  { id: "stat_open_violations", type: "stat", title: "Open Violations", description: "Active violation cases", icon: ShieldAlert, defaultW: 2, defaultH: 2, minW: 2, minH: 2 },
  { id: "stat_collections", type: "stat", title: "Collections", description: "Delinquent units", icon: DollarSign, defaultW: 2, defaultH: 2, minW: 2, minH: 2 },
  { id: "stat_active_owners", type: "stat", title: "Active Owners", description: "Total registered owners", icon: Users, defaultW: 2, defaultH: 2, minW: 2, minH: 2 },
  { id: "stat_open_requests", type: "stat", title: "Open Requests", description: "Awaiting response", icon: MessageCircle, defaultW: 2, defaultH: 2, minW: 2, minH: 2 },

  // ── Chart Cards ──
  { id: "chart_community_health", type: "chart", title: "Community Health", description: "Compliance & delinquency rates", icon: Shield, defaultW: 6, defaultH: 4, minW: 3, minH: 2 },
  { id: "chart_recent_activity", type: "chart", title: "Recent Activity", description: "Latest events feed", icon: Activity, defaultW: 6, defaultH: 4, minW: 3, minH: 2 },

  // ── Table/List Cards ──
  { id: "table_tasks", type: "table", title: "Tasks", description: "Open tasks and assignments", icon: CheckSquare, defaultW: 4, defaultH: 5, minW: 2, minH: 2 },
  { id: "table_projects", type: "table", title: "Projects", description: "Active projects", icon: FolderOpen, defaultW: 4, defaultH: 5, minW: 2, minH: 2 },
  { id: "table_reminders", type: "table", title: "Reminders", description: "Upcoming deadlines", icon: Bell, defaultW: 4, defaultH: 5, minW: 2, minH: 2 },
  { id: "table_stripe", type: "table", title: "Stripe Transactions", description: "Recent payment activity", icon: CreditCard, defaultW: 6, defaultH: 5, minW: 3, minH: 2 },
  { id: "table_form_inbox", type: "table", title: "Form Inbox", description: "Public form submissions", icon: Inbox, defaultW: 6, defaultH: 5, minW: 3, minH: 2 },
  { id: "table_bill_approvals", type: "table", title: "Bill Approvals", description: "Pending approvals & inbound bills", icon: FileCheck, defaultW: 6, defaultH: 5, minW: 3, minH: 3 },
  { id: "table_announcements", type: "table", title: "Announcements", description: "Active announcements", icon: Megaphone, defaultW: 6, defaultH: 4, minW: 3, minH: 2 },

  // ── Quick Action Cards ──
  { id: "quick_actions", type: "quick_action", title: "Quick Actions", description: "Common admin shortcuts", icon: BarChart3, defaultW: 6, defaultH: 3, minW: 2, minH: 2 },

  // ── Status Updates ──
  { id: "status_updates", type: "status_updates", title: "Status Updates", description: "Post updates to associations", icon: MegaphoneIcon, defaultW: 4, defaultH: 6, minW: 3, minH: 4 },
];

export const getCardDef = (cardId: string) => CARD_CATALOG.find(c => c.id === cardId);
