import api from './api';
import { financeiroMock } from './mocks/financeiroMock';
import { handleRequest, simulateLatency } from './serviceUtils';

export const financeiroService = {
  fetchPayables: () => handleRequest({
    mockFn: () => simulateLatency(financeiroMock.payables),
    apiFn: () => api.get('/financeiro/contas-pagar')
  }),

  deleteTransaction: (id) => handleRequest({
    mockFn: () => simulateLatency({ success: true }),
    apiFn: () => api.delete(`/financeiro/transacoes/${id}`)
  }),

  markAsPaid: (id) => handleRequest({
    mockFn: () => simulateLatency({ success: true }),
    apiFn: () => api.put(`/financeiro/transacoes/${id}/pago`)
  })
};
