import { sendJson } from '../http.js';
import { getDeletedEntityList } from '../queries/deleted-entity-list.js';

export const method = 'GET';
export const path = '/v1/deletedentity';

export async function handle(_req, res, { url }) {
  const cursor = Number(url.searchParams.get('lastChangedDeletedEntity')) || 0;
  const limit = Number(url.searchParams.get('limit')) || 600;

  const deletedEntities = await getDeletedEntityList({ cursor, limit });

  return sendJson(res, 200, deletedEntities);
}
