import httpClient from "@/services/httpClient";
import * as urlHelper from "@/libs/url.lib"
import type { Response } from "@/types/response.types"

const _url = urlHelper.withPrefix("/gw/user/paperSection")

export async function record(sectionId: number): Promise<boolean> {
  const resp = await httpClient.post<Response<boolean>>(_url(sectionId))
  return resp.data.data;
}

export async function cancel(sectionId: number): Promise<boolean> {
  const resp = await httpClient.delete<Response<boolean>>(_url(sectionId))
  return resp.data.data
}

export async function query(sectionIds: number[]): Promise<Record<number, boolean>> {
  const resp = await httpClient.post<Response<Record<number, boolean>>>(_url("/query"), sectionIds)
  return resp.data.data
}
