import { observable, makeObservable } from 'mobx';
import { IClaim, IInvoice } from 'typings';

export default class Claim {
  constructor(state: IClaim) {
    this.claimNumber = state.claimNumber;
    this.dueDate = state.dueDate;
    this.finalDueDate = state.finalDueDate;
    this.updated = state.updated;
    this.amount = state.amount;
    this.initialAmount = state.initialAmount;
    this.penalty = state.penalty;
    this.defaultCharges = state.defaultCharges;
    this.otherCharges = state.otherCharges;
    this.motusCharge = state.motusCharge;
    this.totalCharge = state.totalCharge;
    this.invoices = state.invoices;

    makeObservable(this, {
      selected: observable,
      showMoreInvoices: observable,
    });
  }

  claimNumber: string;
  dueDate: Date;
  finalDueDate: Date;
  updated: Date;
  amount: number;
  initialAmount: number;
  penalty: number;
  defaultCharges: number;
  otherCharges: number;
  motusCharge: number;
  totalCharge: number;
  invoices: Array<IInvoice>;

  selected = false;

  showMoreInvoices = false;
}
