import http from '../http-request'

export default {
    /**
     * @api {POST} /login/public_key
     * @apiVersion 0.0.1
     * @desc 获取登录密码加密公钥
     */
    getPublicKey() {
        return http.post('/login/public_key')
    },
    /**
     * @api {POST} /login/doctor
     * @apiVersion 0.0.1
     * @desc 请求登录
     * @param {String} mobile 手机号
     * @param {String} captcha 验证码
     * @param {String} encryedPwd 经过加密后的密码
     * @param {String} platform 请求判断是什么平台端
     */
    login(mobile, captcha, encryedPwd, platform) {
        return http.post('/login/doctor', {
            mobile: mobile,
            captcha: captcha || '',
            password: encryedPwd || '',
            platform: platform
        })
    },
    /**
     * @api {GET}  /doctor/team/info?doctor={code}&team={teamId}
     * @apiVersion 0.0.1
     * @desc 获取验证码
     * @param mobile {string} 手机号码
     */
    getCaptchaAjax(mobile) {
        return http.post(`/common/captcha`, {
            mobile: mobile,
            type: 5,
            captchaToke: ''
        })
    },
    /**
     * @api {GET} /doctor/baseinfo
     * @apiVersion 0.0.1
     * @desc 获取基本信息
     */
    getBaseInfo() {
        return http.get('/doctor/baseinfo', {})
    },
    /**
     * @api {GET}  /doctor/admin-teams/team/{doctor_code}/teams
     * @apiVersion 0.0.1
     * @desc 获取基本信息
     */
    getAdminTeams(code) {
        if (code) {
            return http.get(`/doctor/admin-teams/team/${code}/teams`, {})
        } else {
            return http.get(`/doctor/admin-teams/team/${loginDoctor.code || loginDoctor.uid}/teams`, {})
        }
    },
}
