import { removeEventFromService } from "@/apicalls/custom/events/endpoints";
import { NextRequest } from "next/server";
import { withErrorHandling } from "@/app/api/utils/requestHandlers";
import {
  successResponse,
  errorResponse,
} from "@/app/api/utils/responseHandlers";

export const POST = withErrorHandling(
  async (request: NextRequest, body: any) => {
    const payload = {
      event_uu_id: body.event_uu_id,
      service_uu_id: body.service_uu_id,
    };
    const result = await removeEventFromService(payload);
    if (!result) {
      return errorResponse("Error removing event from service");
    } else {
      return successResponse(result);
    }
  }
);
