import { withAuth, withPermission } from '@/lib/api/helpers';

import { getHandler, patchHandler, deleteHandler } from './handlers';

export const GET = withAuth(withPermission('tenancies', 'view', getHandler));
// PATCH cannot use `withPermission` wrapper - the required permission depends
// on the `action` field in the body. `requirePermission` is called inside the
// handler after the body is parsed.
export const PATCH = withAuth(patchHandler);
export const DELETE = withAuth(withPermission('tenancies', 'cancel', deleteHandler));
