const VAT_FIELDS = ['standard_rate', 'reduced_rate', 'super_reduced_rate', 'parking_rate'];

class VatRate {
  constructor(row = {}) {
    VAT_FIELDS.forEach((k) => { this[k] = row[k] != null ? Number(row[k]) : null; });
    this.id = row.id;
    this.country_id = row.country_id;
    this.effective_from = row.effective_from;
    this.effective_to = row.effective_to;
    this.created_by = row.created_by;
    this.updated_by = row.updated_by;
    this.created_at = row.created_at;
    this.updated_at = row.updated_at;
  }
}

class VatRateHistory extends VatRate {}

module.exports = { VAT_FIELDS, VatRate, VatRateHistory };
