import { LOG } from "@logger";
import base64 from "react-native-base64";
import axiosRequest from "../axiosRequest";
import type { IpaginatedResponse, IpaymentType } from "./types";

const basictoken = base64.encode("admin:admin");

const log = LOG.extend("getPaymentTypes");
const getPaymentTypes = async () => {
	log.http("getPaymentTypes");
	const response = await axiosRequest<IpaginatedResponse<IpaymentType[]>>({
		url: "/operateur/",
		method: "GET",
		headers: {
			// biome-ignore lint/style/useNamingConvention: <explanation>
			Authorization: `Basic ${basictoken}`,
		},
	});
	log.http(JSON.stringify(response, null, 2));
	return response;
};

export default getPaymentTypes;
