import {CompositeFilterDescriptor, GroupDescriptor, SortDescriptor} from '@progress/kendo-data-query';

export class PayInListFilterModel {
  LoanIds: string[];
  UploadIds: string[];
  Take: number;
  Skip: number;
  Sort?: SortDescriptor[];
  Group?: Array<GroupDescriptor>;
  Filter?: CompositeFilterDescriptor;
  constructor(payload: Partial<PayInListFilterModel>) {
    this.LoanIds = [];
    if (payload.LoanIds !== undefined && payload.LoanIds.length > 0) {
      payload.LoanIds.forEach(v => { this.LoanIds.push(v); });
    }
    this.UploadIds = [];
    if (payload.UploadIds !== undefined && payload.UploadIds.length > 0 ) {
      payload.UploadIds.forEach(v => { this.UploadIds.push(v); });
    }
    this.Take = payload.Take || 0;
    this.Skip = payload.Skip || 0;
    this.Sort = payload.Sort || [];
    this.Group = payload.Group || [];
    this.Filter = payload.Filter || { logic: 'and', filters: []  };
  }
}
