import {Component, OnChanges, OnInit} from '@angular/core';

import {LenderIncomeAbstractDirective} from '../../abstract/lender-income-abstract.directive';
import {PayInPepperModel} from '../../models/pay-in-pepper.model';

@Component({
  selector: 'app-lender-pepper-income',
  templateUrl: './lender-pepper-income.component.html',
  styleUrls: ['./lender-pepper-income.component.scss']
})
export class LenderPepperIncomeComponent extends LenderIncomeAbstractDirective implements OnInit, OnChanges {
  InvoiceDate = new Date();
  IncomeType = '';
  Epoc = new Date('1900-01-01');
  constructor() { super('Pepper'); }

  ngOnInit(): void {
    this.analysis.Pepper.forEach(v => {
      v.matchedPayIn = this.matchPayIn(v);
      this.IncomeType = v.IncomeType.toLowerCase();
      this.InvoiceDate = v.InvoiceDate;
      console.log(v.InvoiceDate, this.InvoiceDate);
      this.data.push(new PayInPepperModel(v));
    });
  }

  ngOnChanges(changes): void {
    super.OnChanges(changes);
  }
}
