import { Category, CategoryName } from '../types';

export const categories: Category[] = [
  { id: 1, name: 'Film' },
  { id: 2, name: 'Theater' },
  { id: 3, name: 'Music' },
  { id: 4, name: 'Sports' },
  { id: 5, name: 'Art' },
  { id: 6, name: 'Legends' },
  { id: 7, name: 'Anniversaries' },
  { id: 8, name: 'Memory' }
];

export function getCategoryName(id: number): CategoryName {
  const category = categories.find(c => c.id === id);
  if (!category) {
    throw new Error(`Invalid category ID: ${id}`);
  }
  return category.name;
}

export function getCategoryId(name: CategoryName): number {
  const category = categories.find(c => c.name === name);
  if (!category) {
    throw new Error(`Invalid category name: ${name}`);
  }
  return category.id;
}