import { TrashApi } from "omsorgcore-client-ts";
import { configFor, callApi } from "./apiClientHelpers.js";

// Kapselt /api/trash von omsorgCore (TrashController) über den generierten Client
// (omsorgcore-client-ts) - Papierkorb für die Objekte mit Soft-Delete.

export async function listDeletedEmployees(accessToken, search) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashEmployeesGetRaw({ search }));
}

export async function restoreEmployee(accessToken, id) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashEmployeesIdRestorePostRaw({ id }));
}

export async function listDeletedFacilities(accessToken, search) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashFacilitiesGetRaw({ search }));
}

export async function restoreFacility(accessToken, id) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashFacilitiesIdRestorePostRaw({ id }));
}

export async function listDeletedContracts(accessToken, search) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashContractsGetRaw({ search }));
}

export async function restoreContract(accessToken, id) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashContractsIdRestorePostRaw({ id }));
}

export async function listDeletedOrders(accessToken, search) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashOrdersGetRaw({ search }));
}

export async function restoreOrder(accessToken, id) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashOrdersIdRestorePostRaw({ id }));
}

export async function listDeletedFacilityContacts(accessToken, search) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashFacilityContactsGetRaw({ search }));
}

export async function restoreFacilityContact(accessToken, id) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashFacilityContactsIdRestorePostRaw({ id }));
}

export async function listDeletedFacilityQualificationRates(accessToken, search) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashFacilityQualificationRatesGetRaw({ search }));
}

export async function restoreFacilityQualificationRate(accessToken, id) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashFacilityQualificationRatesIdRestorePostRaw({ id }));
}

export async function listDeletedEmployeeFacilityDistances(accessToken, search) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashEmployeeFacilityDistancesGetRaw({ search }));
}

export async function restoreEmployeeFacilityDistance(accessToken, id) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashEmployeeFacilityDistancesIdRestorePostRaw({ id }));
}

export async function listDeletedAbsences(accessToken, search) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashAbsencesGetRaw({ search }));
}

export async function restoreAbsence(accessToken, id) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashAbsencesIdRestorePostRaw({ id }));
}

export async function listDeletedTimeEntries(accessToken, search) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashTimeEntriesGetRaw({ search }));
}

export async function restoreTimeEntry(accessToken, id) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashTimeEntriesIdRestorePostRaw({ id }));
}

export async function listDeletedAssignments(accessToken, search) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashAssignmentsGetRaw({ search }));
}

export async function restoreAssignment(accessToken, id) {
  const api = new TrashApi(configFor(accessToken));
  return callApi(api.apiTrashAssignmentsIdRestorePostRaw({ id }));
}
