const { v4: uuidv4 } = require('uuid');

class PointLedger {
  constructor({ actorId, sourceService, reason, points, refType, refId, metadata } = {}) {
    this.id = uuidv4();
    this.actorId = actorId || null;
    this.sourceService = sourceService || 'UNKNOWN';
    this.reason = reason || 'UNSPECIFIED';
    this.points = Number(points || 0);
    this.refType = refType || null;
    this.refId = refId || null;
    this.metadata = metadata || {};
    this.createdAt = new Date().toISOString();
  }
}

module.exports = PointLedger;
