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

export interface LicenseException {
	id?: number;
	key: string;
	description: string;
}

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