import { request } from '@/utils'

export const GetRoomFile = (data: any) =>
  request({
    url: `/room/file`,
    method: 'get',
    data
  })
export const DeleteRoomFile = (data: any) =>
  request({
    url: `/room/file`,
    method: 'delete',
    data
  })

export const PostRoomFile = (data: any) =>
  request({
    url: `/room/file`,
    method: 'post',
    data
  })

export const GetRoomUpFileurl = (roomNum: string, fileSuffix: string) =>
  request({
    url: `/room/up-fileurl?roomNum=${roomNum}&fileSuffix=${fileSuffix}`,
    method: 'get',
  })

export const GetRoomFileDwUrl = (fileUrl: string, fileId: string) =>
  request({
    url: `/room/file-dw-url?fileUrl=${fileUrl}&fileId=${fileId}`,
    method: 'get'
  })


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

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


export const PostMuteAll = (data: any) => {
  return request({
    url: `/room/mute-all?roomNum=${data.roomNum}&enableMicr=${data.enableMicr}`,
    method: 'get',
  })
}

export const PostOpenMicr = (data: any) => {
  return request({
    url: `/room/oper-micr?roomNum=${data.roomNum}&enableMicr=${data.enableMicr}&uid=${data.uid}`,
    method: 'get',
  })
}

export const PostOpenCamera = (data: any) =>
  request({
    url: `/room/oper-camera`,
    method: 'get',
    data
  })

export const PostRoomManager = (data: any) =>
  request({
    url: `/room/manager`,
    method: 'post',
    data
  })

export const DeleteRoomManager = (data: any) =>
  request({
    url: `/room/manager`,
    method: 'delete',
    data
  })

export const GetRoomKickout = (roomNum: string, kickUid: string) =>
  request({
    url: `/room/kickout?roomNum=${roomNum}&kickUid=${kickUid}`,
    method: 'get'
  })

export const GetSyncView = (roomNum: string, type: string) =>
  request({
    url: `/room/sync-view?roomNum=${roomNum}&type=${type}`,
    method: 'get'
  })

export const PostRoomInvite = (roomId: string, data: any) =>
  request({
    url: `/room/invite?roomId=${roomId}`,
    method: 'post',
    data
  })
export const GetShowUser = (roomNum: string) =>
  request({
    url: `/room/show-user?roomNum=${roomNum}`,
    method: 'get'
  })

export const PostShowUser = (roomNum: string, uid: string, uname: string) =>
  request({
    url: `/room/show-user?roomNum=${roomNum}&uid=${uid}&uname=${uname}`,
    method: 'post'
  })
export const GetJoin = (data: any) =>
  request({
    url: `/room/join?roomNum=${data.roomNum}&enableMicr=${data.enableMicr}&enableCamera=${data.enableCamera}`,
    method: 'get'
  })
export const GetLeave = (data: any) =>
  request({
    url: `/room/leave?roomNum=${data.roomNum}`,
    method: 'get'
  })
export const GetLeaveAll = (data: any) =>
  request({
    url: `/room/leave-all?roomNum=${data.roomNum}`,
    method: 'get'
  })
export const GetApplySpeak = (roomNum: string) =>
  request({
    url: `/room/apply-speak?roomNum=${roomNum}`,
    method: 'get'
  })
export const GetPolling = (roomNum: string, count: string) =>
  request({
    url: `/room/polling?roomNum=${roomNum}&count=${count}`,
    method: 'get'
  })

export const GetRoomSingnIn = () =>
  request({
    url: `/room/sign-in`,
    method: 'get'
  })

export const PostRoomSingnIn = (data: any) =>
  request({
    url: `/room/sign-in`,
    method: 'post',
    data
  })

export const PutAlterUname = (data: any) =>
  request({
    url: `/room/alter-uname`,
    method: 'put',
    data
  })