import {UserExModel} from './userExModel';

export class PayOutExModel{
    Id: number;
    Ts: Date;
    To: UserExModel;
    Prepared: UserExModel;
    Approved: UserExModel;
    Paid: UserExModel;
    PayDate: Date;
    PayAmount: number;
    Status: string;
    constructor( payload: Partial<PayOutExModel>) {
      this.Id = payload.Id || 0;
      if (payload.Ts){
        this.Ts = new Date( payload.Ts);
      }else{
        this.Ts = new Date('1800-01-01');
      }

      this.To = new UserExModel(payload.To);
      this.Prepared = new UserExModel(payload.Prepared);
      this.Approved = new UserExModel(payload.Approved);
      this.Paid = new UserExModel(payload.Paid);

      if (payload.PayDate) {
        this.PayDate = new Date(payload.PayDate);
      }else{
        this.PayDate = new Date('1800-01-01');
      }
      this.PayAmount = payload.PayAmount || 0;
      this.Status = payload.Status || '';
    }
}
