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

export interface AgencyTariffCode {
	id: number;
	tariff_flag_code: string;
	agency_code: string;
	requirement_level: string;
	program_code: string;
	definition: string;
}

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