export type LoanRow = {
  id: string;
  bankName: string;
  loanName: string;
  loanType: "consumer" | "vehicle" | "housing" | "commercial" | "kmh" | "other";
  principal: number;
  interestRate: number;
  termMonths: number;
  monthlyPayment: number;
  startDate: string;
  paymentDay: number;
  status: "active" | "closed" | "defaulted";
  bankAccountId: string;
  bankAccountLabel: string;
  notes: string;
  totalAmount: number;
  paidAmount: number;
  remainingCount: number;
  nextDue: string | null;
  scope: "company" | "personal";
};

export type InstallmentRow = {
  id: string;
  loanId: string;
  installmentNo: number;
  dueDate: string;
  amount: number;
  principalPart: number;
  interestPart: number;
  paid: boolean;
  paidAt: string;
};

export type BankAccountOption = { id: string; label: string };

export const LOAN_TYPE_LABEL: Record<LoanRow["loanType"], string> = {
  consumer: "İhtiyaç",
  vehicle: "Taşıt",
  housing: "Konut",
  commercial: "Ticari",
  kmh: "KMH",
  other: "Diğer",
};

export const LOAN_STATUS_LABEL: Record<LoanRow["status"], string> = {
  active: "Aktif",
  closed: "Kapalı",
  defaulted: "Temerrüt",
};
