import { FilterOp } from '../enums/filter-op';

export class Filter {
  field: string;
  op: FilterOp;
  values: string[];

  constructor(data: Partial<Filter>) {
    this.field = data?.field ?? '';
    this.op = data?.op ?? FilterOp.Includes;
    this.values = data?.values ?? [];
  }

  toString(): string {
    return `(${this.field}:${this.op}[${this.values.join(',')}])`;
  }
}
