import type { LocalizedString } from './shared-types';
import { dataSets, loadModels } from './loadModels';

export interface MetaGroup {
  readonly meta_group_id: number;
  readonly name: LocalizedString;
  readonly type_ids: number[];
  readonly icon_id?: number;
  readonly icon_suffix?: string;
}

export function getMetaGroup(meta_group_id: number) {
  if (!dataSets.loaded) loadModels();
  const data = dataSets.meta_groups[String(meta_group_id)];
  if (!data) throw new Error(`Meta group ID ${meta_group_id} not found in reference data`);
  return data;
}
