import type { CabinetEventType, CabinetEventSourceType } from '../enums/cabinet-event.enums.js';

export interface CabinetEvent {
  id: string;
  householdId: string;
  userId: string;
  cabinetItemId: string;
  medicineId: string;
  medicineName: string;
  eventType: CabinetEventType;
  quantity: number;
  quantityBefore: number;
  quantityAfter: number;
  unitPrice?: number;
  totalPrice?: number;
  currency?: string;
  storeId?: string;
  storeName?: string;
  sourceType: CabinetEventSourceType;
  sourceId?: string;
  reason?: string;
  notes?: string;
  createdAt: Date;
}

export interface SpendingSummary {
  totalSpent: number;
  currency: string | null;
  byMedicine: SpendingByMedicine[];
  byPeriod: SpendingByPeriod[];
}

export interface SpendingByMedicine {
  medicineId: string;
  medicineName: string;
  totalSpent: number;
  totalQuantity: number;
  avgUnitPrice: number;
  purchaseCount: number;
}

export interface SpendingByPeriod {
  period: string;
  totalSpent: number;
}
