// ─── Core domain types ───

export interface User {
  id: string;
  name: string;
  email: string;
  role: 'partner_a' | 'partner_b';
  locale: SupportedLocale;
  createdAt: string;
}

export interface Household {
  id: string;
  name: string;
  inviteCode: string;
  status: HouseholdStatus;
  children: number;
  housingType: HousingType;
  objectives: string[];
  createdAt: string;
}

export type HouseholdStatus = 'married' | 'common_law' | 'cohabiting' | 'other';
export type HousingType = 'rent' | 'own_mortgage' | 'own_paid' | 'other';
export type SupportedLocale = 'fr' | 'en' | 'ar';

export interface Income {
  userId: string;
  grossAnnual: number;
  netMonthly: number;
  otherIncome: number;
}

export interface Expense {
  id: string;
  householdId: string;
  userId: string;
  amount: number;
  category: ExpenseCategory;
  note: string;
  date: string;
  isCommon: boolean;
}

export type ExpenseCategory =
  | 'housing'
  | 'groceries'
  | 'transport'
  | 'childcare'
  | 'health'
  | 'education'
  | 'utilities'
  | 'insurance'
  | 'leisure'
  | 'clothing'
  | 'savings'
  | 'other';

export interface Budget {
  id: string;
  householdId: string;
  category: ExpenseCategory;
  limit: number;
  period: 'monthly' | 'weekly';
}

export interface DomesticWork {
  userId: string;
  hoursPerWeek: number;
  tasks: DomesticTask[];
}

export interface DomesticTask {
  name: string;
  hoursPerWeek: number;
}

export interface EquitySnapshot {
  id: string;
  householdId: string;
  date: string;
  incomeA: number;
  incomeB: number;
  commonCharges: number;
  domesticHoursA: number;
  domesticHoursB: number;
  domesticHourlyRate: number;
  ratioA: number;
  ratioB: number;
  adjustedRatioA: number;
  adjustedRatioB: number;
}

export interface EquityResult {
  ratioA: number;
  ratioB: number;
  adjustedRatioA: number;
  adjustedRatioB: number;
  domesticValueA: number;
  domesticValueB: number;
  explanation: string;
}

export interface CommonPot {
  householdId: string;
  targetMonthly: number;
  contributionA: number;
  contributionB: number;
  balance: number;
}

export interface QuizState {
  step: number;
  totalSteps: number;
  partnerAName: string;
  partnerBName: string;
  householdStatus: HouseholdStatus | null;
  children: number;
  housingType: HousingType | null;
  objectives: string[];
  incomeA: Partial<Income>;
  incomeB: Partial<Income>;
  charges: Partial<Record<ExpenseCategory, number>>;
  domesticA: Partial<DomesticWork>;
  domesticB: Partial<DomesticWork>;
}

export interface Settings {
  locale: SupportedLocale;
  biometricEnabled: boolean;
  notificationsEnabled: boolean;
  reduceMotion: boolean;
  domesticHourlyRate: number;
  currency: string;
}

export interface Notification {
  id: string;
  title: string;
  body: string;
  type: 'info' | 'alert' | 'reminder';
  read: boolean;
  date: string;
}
