/* eslint-disable */
import request from "@workspace/ui/lib/request";

/**
 * 创建兑换码
 * POST /v1/admin/redemption/code
 * @param body - 创建兑换码请求参数
 * @param options - 可选的请求配置
 * @returns 创建结果
 */
export async function createRedemptionCode(
  body: API.CreateRedemptionCodeRequest,
  options?: { [key: string]: any }
) {
  return request<API.Response & { data?: any }>(
    `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/redemption/code`,
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      data: body,
      ...(options || {}),
    }
  );
}

/**
 * 更新兑换码
 * PUT /v1/admin/redemption/code
 * @param body - 更新兑换码请求参数
 * @param options - 可选的请求配置
 * @returns 更新结果
 */
export async function updateRedemptionCode(
  body: API.UpdateRedemptionCodeRequest,
  options?: { [key: string]: any }
) {
  return request<API.Response & { data?: any }>(
    `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/redemption/code`,
    {
      method: "PUT",
      headers: {
        "Content-Type": "application/json",
      },
      data: body,
      ...(options || {}),
    }
  );
}

/**
 * 删除兑换码
 * DELETE /v1/admin/redemption/code
 * @param body - 删除兑换码请求参数
 * @param options - 可选的请求配置
 * @returns 删除结果
 */
export async function deleteRedemptionCode(
  body: API.DeleteRedemptionCodeRequest,
  options?: { [key: string]: any }
) {
  return request<API.Response & { data?: any }>(
    `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/redemption/code`,
    {
      method: "DELETE",
      headers: {
        "Content-Type": "application/json",
      },
      data: body,
      ...(options || {}),
    }
  );
}

/**
 * 批量删除兑换码
 * DELETE /v1/admin/redemption/code/batch
 * @param body - 批量删除请求参数，包含 ids 数组
 * @param options - 可选的请求配置
 * @returns 批量删除结果
 */
export async function batchDeleteRedemptionCode(
  body: API.BatchDeleteRedemptionCodeRequest,
  options?: { [key: string]: any }
) {
  return request<API.Response & { data?: any }>(
    `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/redemption/code/batch`,
    {
      method: "DELETE",
      headers: {
        "Content-Type": "application/json",
      },
      data: body,
      ...(options || {}),
    }
  );
}

/**
 * 获取兑换码列表
 * GET /v1/admin/redemption/code/list
 * @param params - 分页及筛选参数
 * @param options - 可选的请求配置
 * @returns 兑换码列表及总数
 */
export async function getRedemptionCodeList(
  params: API.GetRedemptionCodeListParams,
  options?: { [key: string]: any }
) {
  return request<API.Response & { data?: API.GetRedemptionCodeListResponse }>(
    `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/redemption/code/list`,
    {
      method: "GET",
      params: {
        ...params,
      },
      ...(options || {}),
    }
  );
}

/**
 * 切换兑换码状态（启用/禁用）
 * PUT /v1/admin/redemption/code/status
 * @param body - 切换状态请求参数
 * @param options - 可选的请求配置
 * @returns 切换结果
 */
export async function toggleRedemptionCodeStatus(
  body: API.ToggleRedemptionCodeStatusRequest,
  options?: { [key: string]: any }
) {
  return request<API.Response & { data?: any }>(
    `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/redemption/code/status`,
    {
      method: "PUT",
      headers: {
        "Content-Type": "application/json",
      },
      data: body,
      ...(options || {}),
    }
  );
}

/**
 * 获取兑换记录列表
 * GET /v1/admin/redemption/record/list
 * @param params - 分页及筛选参数
 * @param options - 可选的请求配置
 * @returns 兑换记录列表及总数
 */
export async function getRedemptionRecordList(
  params: API.GetRedemptionRecordListParams,
  options?: { [key: string]: any }
) {
  return request<API.Response & { data?: API.GetRedemptionRecordListResponse }>(
    `${import.meta.env.VITE_API_PREFIX || ""}/v1/admin/redemption/record/list`,
    {
      method: "GET",
      params: {
        ...params,
      },
      ...(options || {}),
    }
  );
}
