import { api } from "src/boot/axios";
import type { Expense } from "src/modules/timesheets/models/expense.models";

export const ExpenseService = {
    createExpense: async (expense: Expense): Promise<{success: boolean, data: Expense, error?: unknown}> => {
        const response = await api.post('expense/create', expense);
        return response.data;
    },

    updateExpense: async (expense: Expense): Promise<{success: boolean, data: Expense, error?: unknown}> => {
        const response = await api.patch(`expense/update`, expense);
        return response.data;
    },

    deleteExpenseById: async (expense_id: number): Promise<{success: boolean, data: number, error?: unknown}> => {
        const response = await api.delete(`expense/delete/${expense_id}`);
        return response.data;
    }
};