import { request } from '../service/request'

/**
 *
 * token 失效 刷新token使用
 * @param { string } code  Taro.login 的返回值
 */
export const reloadlogin = (code: string) => {
    return request({
        url: `/verify/user/againLogin/${code}`,
        method: 'POST'
    })
}

// export const getUserPhoneNumber = (params: getUserPhoneType) => {
//     const {code, encryptedData, iv } = params
//     console.log(params);
//
//     return request({
//         url: `/verify/bindPhoneNumberV3/${code}`,
//         method: 'POST',
//         data: {
//             encryptedData,
//             iv
//         }
//     })
// }

/**
 * @description 获取用户手机号
 * @param code{string} wx.login获取的code
 * @author 朱波
 * @date 2023/5/6
*/
export const getUserPhoneNumber = (code:string) => {
    return request({
        url: `/verify/wechat/mini-program/login/${code}`,
        method: 'POST',
    })
}



// 获取用户宝贝信息

export const getBaby = () => {
    return request({
        url: `/baby`
    })
}


// 添加宝贝
type postBabyType = {
    img: string,
    gender: number | string,
    birthday: string,
    relation: string,
    name: string,
    relationName: string,
}

export const postBaby = (data: postBabyType) => {
    return request({
        url: `/baby`,
        method: 'POST',
        data
    })
}

// 获取亲属关系
export const getRelation = () => {
    return request({
        url: `/baby/relation`
    })
}



// 领取指导手册

type getManualType = {
    babyId: string,
    goodsTypePdfId: string
}

export const getManual = (data: getManualType[]) => {
    return request({
        url: `/v1/goodsTypePdf/receiveRecord`,
        method: 'POST',
        data
    })
}

/**
 * @description 查询所有分类
 */

 export const getQueryAllCustomerType = () => {
    return request({
        url: `/verify/certificate/queryAllCustomerType`,
        method: 'GET'
    })
}
