import request from '../utils/request'

/**
 * 分页查询广告自动划配置列表
 */
export function getAdAutoConfList(params) {
  return request({
    url: '/api/ad-auto-conf/list',
    method: 'get',
    params
  })
}

/**
 * 获取广告自动划配置详情
 */
export function getAdAutoConfDetail(id) {
  return request({
    url: `/api/ad-auto-conf/${id}`,
    method: 'get'
  })
}

/**
 * 保存广告自动划配置（新增或更新）
 */
export function saveAdAutoConf(data) {
  return request({
    url: '/api/ad-auto-conf',
    method: 'post',
    data
  })
}

export function updateAutoConf(data) {
  return request({
    url: '/api/ad-auto-conf/update',
    method: 'post',
    data
  })
}

/**
 * 删除广告自动划配置
 */
export function deleteAdAutoConf(id) {
  return request({
    url: `/api/ad-auto-conf/${id}`,
    method: 'delete'
  })
}

/**
 * 批量删除广告自动划配置
 */
export function batchDeleteAdAutoConf(ids) {
  return request({
    url: '/api/ad-auto-conf/batch',
    method: 'delete',
    data: ids
  })
}

/**
 * 执行广告自动划配置
 */
export function executeAdAutoConf(id) {
  return request({
    url: `/api/ad-auto-conf/execute?id=${id}`,
    method: 'post'
  })
}

/**
 * 分页查询执行日志
 */
export function getExecuteLogList(params) {
  return request({
    url: '/api/execute-log/list',
    method: 'get',
    params
  })
}

/**
 * 查询子日志
 */
export function getChildLog(params) {
  return request({
    url: '/api/execute-log/getChildLog',
    method: 'get',
    params
  })
}
