import { v4 as uuidv4 } from 'uuid';

export interface Currency {
  id: string;
  code: string;
  name: string;
  symbol: string;
  decimal_places: number;
  format: string;
  is_active: boolean;
  is_default: boolean;
  created_by: string;
  updated_by: string;
  created_at: Date;
  updated_at: Date;
}

export class CurrencyModel {
  static create(data: Omit<Currency, 'id' | 'created_at' | 'updated_at'>): Currency {
    const now = new Date();
    return {
      id: uuidv4(),
      ...data,
      created_at: now,
      updated_at: now,
    };
  }

  static update(currency: Currency, data: Partial<Omit<Currency, 'id' | 'created_at'>>): Currency {
    return {
      ...currency,
      ...data,
      updated_at: new Date(),
    };
  }
}
