import {UserExModel} from './userExModel';

export class PayoutModel {
  Id: number;
  Ts: Date;
  To: string;
  Prepared: string;
  Approved: string;
  Paid: string;
  PayDate: Date;
  PayAmount: number;
  Status: string;
  RewardIds?: number[];
  constructor( payload?: Partial<PayoutModel>){
    if (! payload ) { payload = {}; }
    this.Id = payload.Id || 0;
    if ( payload.Ts ){
      this.Ts = new Date(payload.Ts);
    }else{
      this.Ts = new Date('1900-01-01');
    }
    this.To = payload.To || '';
    this.Prepared = payload.Prepared || '';
    this.Approved = payload.Approved || '';
    this.Paid = payload.Paid || '';
    if (payload.PayDate){
      this.PayDate = new Date(payload.PayDate);
    }else{
      this.PayDate = new Date('1900-01-01');
    }
    this.PayAmount = payload.PayAmount || 0;
    this.Status = payload.Status || '';
    this.RewardIds = [];
    if ( Array.isArray(payload) ) {
      this.RewardIds = payload.RewardIds;
    }
  }
}
