import apiClient from "@/api/client";

export interface EmailConfig {
	id?: number;
	name: string;
	email: string;
	type: string;
	isActive?: boolean;
}

// GET ALL
export const getEmailConfigsApi = async () => {
	const res = await apiClient.get("/email/getAll");
	return res.data;
};

// CREATE
export const createEmailConfigApi = async (data: EmailConfig) => {
	const res = await apiClient.post("/email", data);
	return res.data;
};

// UPDATE
export const updateEmailConfigApi = async (
	id: number,
	data: Partial<EmailConfig>,
) => {
	const res = await apiClient.patch(`/email/${id}`, data);
	return res.data;
};

// DELETE
export const deleteEmailConfigApi = async (id: number) => {
	const res = await apiClient.delete(`/email/${id}`);
	return res.data;
};
