import { ANY } from '../../constants';

function buildAnyOption() {
  return {
    id: ANY,
    displayName: ANY,
  };
}

export function buildCustomOption({ value, label, direction }) {
  return {
    id: value,
    displayName: label,
    direction,
  };
}

export function buildCustomOptions(mainSelectorOptionsCustom) {
  const anyOption = buildAnyOption();
  const customOptions = mainSelectorOptionsCustom.map(buildCustomOption);

  return [anyOption, ...customOptions];
}

export function buildChickletValue(customOption) {
  return {
    value: customOption.id,
    chickletLabel: customOption.displayName,
    option: customOption.id,
    direction: customOption.direction,
  };
}
