// import request from '@/views/conferencingRoom/utils/request.js'
// import { tansParams } from "@/utils/ruoyi";

import request from '@/utils/request'

// 创建房间获取token
export function getRoomToken(data) {  
    return request({
        url: `/api/v1/rooms/create`,
        method: 'post',
        data: data,  
    })
}

//邀请用户参与房间
export function getInvite(room_uid,data) {  
    return request({
        url: `/api/v1/meeting/${room_uid}/invite`,
        method: 'post',
        data: data,  
    })
}

// 创建房间
export function createRoom(data) {  
    return request({
        url: `/room/`,
        method: 'post',
        data: tansParams(data),  
    })
}

//获取所有房间列表
export function getRoomList() { 
    return request({
        url: `/room/ `,
        method: 'get',
    })
}

//修改状态  加入  退出
export function getStatusApi(room_uid,data) {  
    return request({
        url: `/api/v1/meeting/${room_uid}/status`,
        method: 'post',
        data: data,  
    })
}

//参与者获取token
export function getTokenApi(room_uid) {  
    return request({
        url: `/api/v1/meeting/${room_uid}/token`,
        method: 'get',
         
    })
}

//用户退出房间
export function exitRoomApi(room_uid) {  
    return request({
        url: `/api/v1/meeting/${room_uid}/leave`,
        method: 'post',  
    })
}

//获取当前房间信息
export function getRoomInfoApi(room_uid) {  
    return request({
        url: `/api/v1/meeting/${room_uid}/info`,
        method: 'get',  
    })
}

//获取文件列表
export function getFileListApi(room_uid) {  
    return request({
        url: `/api/v1/conversion/${room_uid}/files`,
        method: 'get',  
        // params:{
        //     service: room_uid
        // }
    })
}

//上传文件获取token
export function getUploadTokenApi(data) {  
    return request({
        url: `/api/file/token`,
        method: 'post',  
        data: data, 
    })
}

//上传文件
export function uploadFileApi(token,data) {  
    return request({
        url: `/api/file/${token}/upload`,
        method: 'post',  
        data: data, 
        headers: {
            'Content-Type': 'multipart/form-data',
        },
    })
}

//提交一个文档转换任务，将指定的 Office 文档转换为 PDF 格式
export function convertFileApi(data,roomId) {  
    return request({
        url: `/api/v1/conversion/${ roomId }/convert`,
        method: 'post',  
        data: data,  
    })
}

//获取文档转换任务状态结构
export function getConvertStatusApi(taskId,roomId) {  
    return request({
        url: `/api/v1/conversion/${ roomId }/status/${taskId}`,
        method: 'get',  
    })
}

//获取当前会议中所有参与者信息
export function getParticipantsApi(roomId) {  
    return request({
        url: `/api/v1/meeting/${ roomId }/participants`,
        method: 'get',  
    })
}
 

// 获取当前房间中视频
export function getvideoUrlApi(room_uid) {  
    return request({
        url: `/api/v1/room/${ room_uid }/recordings`,
        method: 'get',   
    })
}

