import http from './request'
import {get, post, uploadFile} from './http'
// 发信息
// export async function sendMsg(params) {
// 	let data = await http('/v1/im/message-send', params)
// 	return data
// }
// 登录 手机号授权
export async function sendToUserApi(params) {
    return await http('/imApi/send-to-user', {
        method: 'POST',
        data: params,
        // 传输方式是json
        headers: {
            'Content-Type': 'application/json'
        }
    }, 1)
}

/**
 * 获取房间聊天记录
 * @param params
 * @returns {Promise<*>}
 */
export async function getMessagesByRoomIdApi(params) {
    return await post('/chat-friends/messages-by-room-id', params, 3)
}

/**
 * 创建房间 - 根据医生id
 * @param params
 * @returns {Promise<*>}
 */
export async function createRoomByDoctorIdApi(params) {
    return await post('/chat-friends/create-room-by-doctor-id', params, 3)
}

/**
 * 获取聊天好友列表
 * @param params
 * @returns {Promise<*>}
 */
export async function getChatFriendsListApi(params) {
    return await get('/chat-friends/list', params, 3)
}
/**
 * 获取聊天注册信息
 * @param params
 * @returns {Promise<*>}
 */
export async function getChatRegisterInfoApi(params) {
    return await get('/chat-friends/chat-register-info', params, 3)
}

/**
 * 上传聊天文件
 * @param params
 * @returns {Promise<*>}
 */
export function upLoadChatFileApi(params) {
    return console.log('aaaaaaaaaaaaaaaaaaa', uploadFile('/chat-friends/upload-chat-file', params))
    return uploadFile('/chat-friends/upload-chat-file', params)
}

/**
 * 获取医生信息
 * @param params { doctor_id: string }
 * @returns {Promise<*>}
 */
export async function getDoctorInfoApi(params) {
    return await get('/chat-friends/get-doctor-info', params, 3)
}

/**
 * 获取房间状态
 * @param params { room_id: string }
 * @returns {Promise<*>}
 */
export async function getRoomStatusApi(params) {
    return await get('/chat-friends/get-room-status', params, 3)
}