export const standardCourseCategoryOptions = [
  { value: 'K', label: 'K' },
  { value: 'S', label: 'S' },
  { value: 'A', label: 'A' }
];

const legacyCourseCategoryOptions = [
  { value: 'Safety', label: 'Legacy: Safety' },
  { value: 'Quality', label: 'Legacy: Quality' },
  { value: 'Technical', label: 'Legacy: Technical' },
  { value: 'Compliance', label: 'Legacy: Compliance' },
  { value: 'Leadership', label: 'Legacy: Leadership' },
  { value: 'Operations', label: 'Legacy: Operations' }
];

export const courseCategoryFilterOptions = [
  ...standardCourseCategoryOptions,
  ...legacyCourseCategoryOptions
];

export function getCourseCategoryOptions(selectedCategory?: string | null) {
  if (
    selectedCategory &&
    !courseCategoryFilterOptions.some((option) => option.value === selectedCategory)
  ) {
    return [
      ...standardCourseCategoryOptions,
      {
        value: selectedCategory,
        label: `Legacy: ${selectedCategory}`
      }
    ];
  }

  return standardCourseCategoryOptions;
}
