import { db } from "@/db";
import { categories } from "@/db/schema";

export const DEFAULT_CATEGORIES: Array<{
  name: string;
  kind: "income" | "expense" | "transfer";
  color: string;
  icon: string;
}> = [
  { name: "Salary", kind: "income", color: "#10b981", icon: "Briefcase" },
  { name: "Business", kind: "income", color: "#06b6d4", icon: "Store" },
  { name: "Other Income", kind: "income", color: "#22c55e", icon: "PiggyBank" },
  { name: "Rent", kind: "expense", color: "#f97316", icon: "Home" },
  { name: "Mortgage", kind: "expense", color: "#fb923c", icon: "House" },
  { name: "Groceries", kind: "expense", color: "#eab308", icon: "ShoppingCart" },
  { name: "Food & Dining", kind: "expense", color: "#f59e0b", icon: "UtensilsCrossed" },
  { name: "Subscriptions", kind: "expense", color: "#a855f7", icon: "PlaySquare" },
  { name: "Utilities", kind: "expense", color: "#0ea5e9", icon: "Zap" },
  { name: "Transport", kind: "expense", color: "#3b82f6", icon: "Car" },
  { name: "Insurance", kind: "expense", color: "#ec4899", icon: "ShieldCheck" },
  { name: "Debt Repayment", kind: "expense", color: "#ef4444", icon: "CreditCard" },
  { name: "Savings", kind: "transfer", color: "#14b8a6", icon: "Landmark" },
  { name: "Other", kind: "expense", color: "#6b7280", icon: "Tag" },
];

export async function seedHouseholdDefaults(householdId: string) {
  await db.insert(categories).values(
    DEFAULT_CATEGORIES.map((c) => ({ householdId, ...c })),
  );
}
