import { request } from 'umi';
import { api } from '../api';
/**
 * 定向标签获取
 * 
*/
export async function getTagsList(params: any) {
    return request(api + `/adq/launch/tools/targeting/tags/list`, {
        method: 'POST',
        data: params
    })
}
/**
 * 场景定向标签获取
 * */

export async function getSceneTagsList(params: any) {
    return request(api + `/adq/launch/tools/scene/spec/tags/list`, {
        method: 'POST',
        data: params
    })
}
/**
 * 创意形式详细信息
 * @param promotedObjectType 推广目标
 * @param adcreativeTemplateId 创意形式ID
 * @param siteSet 数组版位 
 * https://developers.e.qq.com/docs/api/tools/adcreative_template/adcreative_template_get?version=1.3&_preview=1
 * https://developers.e.qq.com/docs/tools/adcreative_template
 * */

export async function get_adcreative_template(params: any) {
    return request(api + `/adq/launch/tools/adcreative/template`, {
        method: 'POST',
        data: params
    })
}
/**
 * 创意形式列表信息
 * @param promotedObjectType 推广目标
 * @param siteSet 数组版位 
 * @param campaignType 投放位置
 * https://developers.e.qq.com/docs/api/tools/adcreative_template/adcreative_template_list_get?version=1.3&_preview=1
 * */

export async function get_adcreative_template_list(params: any) {
    return request(api + `/adq/launch/tools/adcreative/template/list`, {
        method: 'POST',
        data: params
    })
}
/**
 * 文案助手
 * */
export async function getText(params: {
    maxTextLength: number,
    adAccountId: number,
}) {
    return request(api + `/adq/launch/tools/creative/tools/text`, {
        method: 'GET',
        params
    })

}
/**
 * 视频封面图生成
 * */
export async function get_tools_video_capture(params: any) {
    return request(api + `/adq/launch/tools/video/maker/capture`, {
        method: 'POST',
        data: params
    })
}

/**
 * 获取品牌形象列表
 * @returns 
 */
export async function getSysBrandApi() {
    return request(api + `/adq/sysBrand/allOfUser`, {
        method: 'GET'
    })
}

/**
 * 新增品牌形象
 * @param data 
 * @returns 
 */
export async function addSysBrandApi(data: { name: string, brandImgUrl: string }) {
    return request(api + `/adq/sysBrand`, {
        method: 'POST',
        data
    })
}

/**
 * 修改品牌形象
 * @param data 
 * @returns 
 */
export async function editSysBrandApi(data: { name: string, brandImgUrl: string, sysBrandId: number }) {
    const { sysBrandId, ...params } = data
    return request(api + `/adq/sysBrand/${sysBrandId}`, {
        method: 'PUT',
        data: params
    })
}

/**
 * 删除品牌形象
 * @param data 
 * @returns 
 */
export async function delSysBrandApi(data: { sysBrandId: number }) {
    const { sysBrandId } = data
    return request(api + `/adq/sysBrand/${sysBrandId}`, {
        method: 'DELETE'
    })
}


/**
 * 获取头像及昵称跳转页
 * @returns
 */
export async function getSysProfileApi() {
    return request(api + `/adq/sysProfile/allOfUser`, {
        method: 'GET'
    })
}

/**
 * 新增头像及昵称跳转页
 * @param data 
 * @returns 
 */
export async function addSysProfileApi(data: { name: string, brandImgUrl: string }) {
    return request(api + `/adq/sysProfile`, {
        method: 'POST',
        data
    })
}

/**
 * 修改头像及昵称跳转页
 * @param data 
 * @returns 
 */
export async function editSysProfileApi(data: { name: string, brandImgUrl: string, sysProfileId: number }) {
    const { sysProfileId, ...params } = data
    return request(api + `/adq/sysProfile/${sysProfileId}`, {
        method: 'PUT',
        data: params
    })
}

/**
 * 删除头像及昵称跳转页
 * @param data 
 * @returns 
 */
export async function delSysProfileApi(data: { sysProfileId: number }) {
    const { sysProfileId } = data
    return request(api + `/adq/sysProfile/${sysProfileId}`, {
        method: 'DELETE'
    })
}

/**查询优化目标权限*/
export async function getOptimizationGoalPermissions(data: any) {
    return request(api + `/adq/launch/tools/getOptimizationGoalPermissions`, {
        method: 'POST',
        data
    })
}

/**
 * 广告预览二维码
 * @param param0 
 * @returns 
 */
export async function getAdcreativePreviewsQrcodeApi({ accountId, adgroupId }: { accountId: number, adgroupId: number }) {
    return request(api + `/adq/launch/tools/getAdcreativePreviewsQrcode/${accountId}/${adgroupId}`, {
        method: 'GET'
    })
}

/**
 * 广告创意预览链接
 * @param param0 
 * @returns 
 */
export async function getAdcreativeTemplatePreviewsApi({ accountId, adgroupId }: { accountId: number, adgroupId: number }) {
    return request(api + `/adq/launch/tools/adcreativeTemplatePreviews/${accountId}/${adgroupId}`, {
        method: 'GET'
    })
}


/**
 * 广告创意预览链接
 * @param param0 
 * @returns 
 */
export async function getAdcreativeTemplatePreviews1Api({ adAccountId, adgroupId, adIdList }: { adAccountId: number, adgroupId: number, adIdList: any }) {
    return request(api + `/adq/launch/tools/adcreativeTemplatePreviews/${adAccountId}/${adgroupId}/${adIdList}`, {
        method: 'GET'
    })
}