import api from 'src/config/api';

import { type PayrollReceipt } from './types';

export const getPayrollReceipts = () =>
  api.get<PayrollReceipt[]>('mobility-ado/payroll-receipts');

export const getPayrollReceiptPdf = (receipt: PayrollReceipt) =>
  api.get<Blob>('mobility-ado/payroll-receipts/pdf', {
    headers: { Accept: 'application/pdf' },
    params: {
      ejercicio: receipt.ejercicio,
      mes: receipt.idMes,
      empresa: receipt.idEmpresa,
      trabajador: receipt.idTrabajador,
      tipoNomina: receipt.idNomina,
      persistido: receipt.persistido,
    },
    responseType: 'blob',
  });
