import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AdBannerVO, AdBannerForm, AdBannerQuery } from '@/api/system/physical/adBanner/types';

/**
 * 查询广告位列表
 * @param query
 * @returns {*}
 */

export const listAdBanner = (query?: AdBannerQuery): AxiosPromise<AdBannerVO[]> => {
  return request({
    url: '/physical/adBanner/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询广告位详细
 * @param id
 */
export const getAdBanner = (id: string | number): AxiosPromise<AdBannerVO> => {
  return request({
    url: '/physical/adBanner/' + id,
    method: 'get'
  });
};

/**
 * 新增广告位
 * @param data
 */
export const addAdBanner = (data: AdBannerForm) => {
  return request({
    url: '/physical/adBanner',
    method: 'post',
    data: data
  });
};

/**
 * 修改广告位
 * @param data
 */
export const updateAdBanner = (data: AdBannerForm) => {
  return request({
    url: '/physical/adBanner',
    method: 'put',
    data: data
  });
};

/**
 * 删除广告位
 * @param id
 */
export const delAdBanner = (id: string | number | Array<string | number>) => {
  return request({
    url: '/physical/adBanner/' + id,
    method: 'delete'
  });
};
