import { requestClient } from '#/api/request';

/**
 * 接管相关接口定义 - 根据RobotManualControlAuthController同步
 */

/**
 * 接管机器人
 */
export async function takeOverApi(params: { robotUuid: string; durationMinutes?: number }) {
  return requestClient.post('/auth/RobotManualControl/takeOver', params);
}

/**
 * 释放机器人
 */
export async function releaseApi(params: { robotUuid: string }) {
  return requestClient.post('/auth/RobotManualControl/release', params);
}

/**
 * 机器人登录
 */
export async function robotLoginApi(params: { robotUuid: string }) {
  return requestClient.post('/auth/RobotManualControl/login', params);
}

/**
 * 机器人登出
 */
export async function robotLogoutApi(params: { robotUuid: string }) {
  return requestClient.post('/auth/RobotManualControl/logout', params);
}

/**
 * 获取直播间在线列表
 */
export async function getLiveRoomsApi(params) {
  return requestClient.post('/auth/RobotManualControl/liveRooms', params);
}

/**
 * 进入直播间
 */
export async function enterLiveRoomApi(params: { robotUuid: string; roomId: number }) {
  return requestClient.post('/auth/RobotManualControl/enterRoom', params);
}

/**
 * 退出直播间
 */
export async function quitLiveRoomApi(params: { robotUuid: string }) {
  return requestClient.post('/auth/RobotManualControl/quitRoom', params);
}

/**
 * 点赞直播间
 */
export async function likeApi(params: { robotUuid: string }) {
  return requestClient.post('/auth/RobotManualControl/like', params);
}

/**
 * 关注主播
 */
export async function followApi(params: { robotUuid: string }) {
  return requestClient.post('/auth/RobotManualControl/follow', params);
}

/**
 * 获取礼物列表
 */
export async function getGiftListApi(params: { robotUuid: string }) {
  return requestClient.post('/auth/RobotManualControl/giftList', params);
}

/**
 * 送礼
 */
export async function sendGiftApi(params: { robotUuid: string; giftId: number }) {
  return requestClient.post('/auth/RobotManualControl/sendGift', params);
}

/**
 * 获取机器人余额
 */
export async function getFeeApi(params: { robotUuid: string }) {
  return requestClient.post('/auth/RobotManualControl/getFee', params);
}

/**
 * 发送聊天消息
 */
export async function sendMessageApi(params: { robotUuid: string; message: string }) {
  return requestClient.post('/auth/RobotManualControl/sendMessage', params);
}



/**
 * 获取聊天消息
 * @param params
 *  @param robotUuid 机器人UUID
 *  @param skip 跳过的消息数量
 *  @param limit 获取的消息数量
 */
export async function getMessagesApi(params: { robotUuid: string; skip?: number; limit?: number }) {
  return requestClient.post('/auth/RobotManualControl/getMessages', params);
}



/**
 * 接管接口集合
 */
export const takeoverApi = {
  takeOver: takeOverApi,
  release: releaseApi,
  robotLogin: robotLoginApi,
  robotLogout: robotLogoutApi,
  getLiveRooms: getLiveRoomsApi,
  enterLiveRoom: enterLiveRoomApi,
  quitLiveRoom: quitLiveRoomApi,
  like: likeApi,
  follow: followApi,
  getGiftList: getGiftListApi,
  sendGift: sendGiftApi,
  sendMessage: sendMessageApi,
  getFee: getFeeApi,
  getMessages: getMessagesApi,
};