import { UserProgressDto } from '@/shared/types/userProgress';
import { ZoneColor } from '@/shared/types/app';

export function toLearnedSignIds(progress: readonly UserProgressDto[]): ReadonlySet<string> {
  return new Set(progress.map((item) => item.item_id));
}

export function toZoneColor(value: string | null): ZoneColor | null {
  if (!value) {
    return null;
  }

  if (value === 'blue' || value === 'green' || value === 'yellow' || value === 'red') {
    return value;
  }

  return null;
}
