import { api } from '$lib/api';

export interface IdentifierCatalog {
	id?: number;
	key: string;
	description: string;
	level: string;
	complement: string;
}

export const identifiersApi = {
	list: async (page = 1, pageSize = 50, q = '') => {
		const params = new URLSearchParams({
			page: page.toString(),
			page_size: pageSize.toString(),
			q: q
		});
		return api.get<{ items: IdentifierCatalog[]; total: number }>(
			`/v1/public/reference_data/identifiers/?${params.toString()}`
		);
	},
	get: async (id: number) => {
		return api.get<IdentifierCatalog>(`/v1/public/reference_data/identifiers/${id}`);
	}
};
