import { javaPost } from '@/services/apiClient';

import { MetaAttribute } from '@/types/Attributes';

// esemenyMMATagozat = 107
// esemenyFoTipusa = 110
// esemenyKategoria = 111

type AttrId = 107 | 110 | 111;

export async function getMetaAttributeList(attrId: AttrId): Promise<MetaAttribute[]> {
  try {
    const response = await javaPost('metaAttributeComponentControl/getMetaCombo', {
      attrId,
    });

    if (response && response.length > 0) {
      return response;
    }
  } catch (error) {
    console.error('Failed to fetch meta attribute list:', error);
  }

  return [];
}
