import { api } from "@/lib/api-client";
import type { PendingScore } from "@/types";
import type { ApiSuccessResponse } from "@/types";

export const scoreReleaseService = {
  getPending: (params?: { page?: number; limit?: number }) =>
    api.get<{ data: PendingScore[]; pagination: { total: number; page: number } }>("/scores/pending", params as Record<string, string | number | boolean | undefined>),

  release: (attemptId: number) =>
    api.post<ApiSuccessResponse>(`/scores/${attemptId}/release`),

  reject: (attemptId: number, reason: string) =>
    api.post<ApiSuccessResponse>(`/scores/${attemptId}/reject`, { reason }),

  bulkRelease: (attemptIds: number[]) =>
    api.post<ApiSuccessResponse>("/scores/bulk-release", { attempt_ids: attemptIds }),
};
