import { TQueryParams } from '../../models/QueryResult.model';
import { addHeaderToData } from '../../helpers/excel.helper';
import { getDuplicates } from '../../db/receivables.db';

export const getReceivableDuplicatesFull = async (params: TQueryParams) => {
  const data = await getReceivableDuplicates(params);
  const header = getReceivableDuplicatesHeader();
  return addHeaderToData(header, data);
};

export const getReceivableDuplicates = async (params: TQueryParams) => {
  const { bbcDateId } = params;
  return getDuplicates(bbcDateId.toString());
};

const getReceivableDuplicatesHeader = () => {
  return {
    _id: 'Index',
  };
};
