import { request } from '@/utils'
export const GetRoom = (data: { pageIndex: number, pageSize: number }) =>
  request({
    url: `/home/room?pageIndex=${data.pageIndex}&pageSize=${data.pageSize}`,
    method: 'get'
  })

export const PostRoom = (data: any) =>
  request({
    url: `/home/room`,
    method: 'post',
    data,
  })
export const PostRoomInfo = (data: any) =>
  request({
    url: `/home/room-info`,
    method: 'put',
    data,
  })
export const DeleteRoom = (roomId: string) =>
  request({
    url: `/home/room?roomId=${roomId}`,
    method: 'delete',
  })

export const GetCheckoutRoomNum = (roomNum: string) =>
  request({
    url: `/room/checkout?roomNum=${roomNum}`,
    method: 'get',
  })

export const GetRoomRtcToken = (roomNum: string) =>
  request({
    url: `/room/tk/rtc?roomNum=${roomNum}`,
    method: 'get',
  })

export const GetRoomInfo = (roomNum: string) =>
  request({
    url: `/room/${roomNum}`,
    method: 'get',
  })

export const GetAgoraConf = () =>
  request({
    url: `/home/agora-conf`,
    method: 'get',
  })
export const GetQrcode = (roomNum: string, env: string) =>
  request({
    url: `/home/r-qrcode?roomNum=${roomNum}&env=${env}`,
    method: 'get',
  })

export const GetRecord = (beginTimestamp: number, endTimestamp: number, roomNum: string) =>
  request({
    url: `/home/record?beginTimestamp=${beginTimestamp}&endTimestamp=${endTimestamp}&roomNum=${roomNum}`,
    method: 'get',
  })

