type Comparison = {
  label: string;
  focus: string;
  question: string;
  related: string[];
};

export const loanComparisons: Record<string, Comparison> = {
  "personal-loan": {
    label: "Personal Loan",
    focus: "Personal expenses",
    question: "What are the total cost and repayment schedule?",
    related: ["payday-loan", "home-renovation-loan"],
  },
  "business-loan": {
    label: "Business Loan",
    focus: "Business funding and operating expenses",
    question: "Which business documents are needed?",
    related: ["personal-loan", "foreigner-loan"],
  },
  "foreigner-loan": {
    label: "Foreigner Loan",
    focus: "Loan information for foreigners in Singapore",
    question: "Which residency and income documents are needed?",
    related: ["personal-loan", "payday-loan"],
  },
  "payday-loan": {
    label: "Pay Day Loan",
    focus: "Expenses before the next payday",
    question: "When is repayment due and what is the total cost?",
    related: ["personal-loan", "debt-consolidation-plan"],
  },
  "debt-consolidation-plan": {
    label: "Debt Consolidation Plan",
    focus: "Combining existing debts",
    question: "Which debts can be included and what would repayment involve?",
    related: ["personal-loan", "payday-loan"],
  },
  "home-renovation-loan": {
    label: "Home Renovation Loan",
    focus: "Home renovation expenses",
    question: "Which renovation documents are needed?",
    related: ["personal-loan", "business-loan"],
  },
};

export function comparisonRows(slug: string) {
  if (!Object.hasOwn(loanComparisons, slug)) return [];
  return [slug, ...loanComparisons[slug].related].map((key) => ({
    slug: key,
    ...loanComparisons[key],
  }));
}
