import { SegmentAttributeComparator } from "@komi-app/fans-sdk";
import { SelectOption } from "../../types/select";

export const comparatorLabelMap: Record<SegmentAttributeComparator, string> = {
  [SegmentAttributeComparator.Lt]: 'Less than',
  [SegmentAttributeComparator.Lte]: 'Less than or equal to',
  [SegmentAttributeComparator.Gt]: 'Greater than',
  [SegmentAttributeComparator.Gte]: 'Greater than or equal to',
  [SegmentAttributeComparator.Eq]: 'Equals',
  [SegmentAttributeComparator.Neq]: 'Does not equal',
  [SegmentAttributeComparator.Bt]: 'Between',
  [SegmentAttributeComparator.Nbt]: 'Not between',
};

const comparators: SegmentAttributeComparator[] = Object.values(SegmentAttributeComparator);
export const comparatorOptions = comparators.map<SelectOption<SegmentAttributeComparator>>(
  (comparator) => ({ label: comparatorLabelMap[comparator], value: comparator }),
);
