import { request } from 'umi';
import { ListData, SysAdgroupsDTO } from '.';
import { api } from '../api';

/**
 * 获取广告组列表
 * @param adgroupName 广告名称
 * @param promotedObjectType 广告类型
 */
export async function getSysAdgroupsList(params: {
  pageNum: number;
  pageSize: number;
  adgroupName?: string;
  promotedObjectType?: string;
}):Promise<ListData<SysAdgroupsDTO>>{
  return request(api + '/adq/sysAdgroups/list', {
    method: 'POST',
    data: params,
  })
}
/**
 * 获取广告详情
 * @param adgroupsId 广告ID
 */ 
 export async function getSysAdgroupsInfo(adgroupsId: any){
    return request(api + `/adq/sysAdgroups/${adgroupsId}`)
  }
/**
 * 新增广告
 * */ 
export async function createSysAdgroups(params:SysAdgroupsDTO){
    return request(api+`/adq/sysAdgroups`,{
        method:'POST',
        data:params
    })
}
/**
 * 编辑广告
 * */ 
export async function editSysAdgroups(adgroupsId:string,params:SysAdgroupsDTO){
    return request(api+`/adq/sysAdgroups/${adgroupsId}`,{
        method:'PUT',
        data:params
    })
}
/**
 * 删除广告
 * */ 
export async function delSysAdgroups(adgroupsId:string){
    return request(api+`/adq/sysAdgroups/${adgroupsId}`,{
        method:'DELETE',
    })
}
