import axios from '../request';
import {
  BackEndLoginType,
  batchRemoveBannerInfo,
  exchangeBannerInfo,
  insertBannerInfo,
  insertModuleInfo,
  listBannerInfoPage,
  listModuleInfoPage,
  releaseTenderNews,
  releaseTenderNewsAdd,
  releaseTenderNewsDelete,
  releaseTenderNewsUpdate,
  removeBannerInfo,
  removeModuleInfo,
  updateBannerInfo,
  updateModuleInfo,
  updateModuleInfoRemark,
  uploadOssBPType,
  uploadOssType,
} from '~/api/interface/commonType';

export class CommonAPI {
  // 用户登录
  static BackEndLogin: BackEndLoginType = (params) =>
    axios.post('/userapp/auth/backEndLogin', params);

  // 上传图片
  static uploadOss: uploadOssType = (params) => axios.post('/pms/upload/oss', params);

  // 断点上传
  static uploadOssBP: uploadOssBPType = (params) => axios.post('/pms/upload/breakpoint', params);

  // V1.0.1-宣传模块管理-分页
  static listModuleInfoPage: listModuleInfoPage = (params) =>
    axios.post('/release/module/listModuleInfoPage', params);

  // 修改宣传备注
  static updateModuleInfoRemark: updateModuleInfoRemark = (params) =>
    axios.get('/release/module/updateModuleInfoRemark', { params });

  // V1.0.1-删除宣传模块
  static removeModuleInfo: removeModuleInfo = (params) =>
    axios.get('/release/module/removeModuleInfo', { params });

  // V1.0.1-宣传模块-新增
  static insertModuleInfo: insertModuleInfo = (params) =>
    axios.post('/release/module/insertModuleInfo', params);

  // 宣传模块-修改
  static updateModuleInfo: updateModuleInfo = (params) =>
    axios.post('/release/module/updateModuleInfo', params);

  // V1.0.1-banner管理-分页
  static listBannerInfoPage: listBannerInfoPage = (params) =>
    axios.post('/release/module/listBannerInfoPage', params);

  // V1.0.1-banner-新增
  static insertBannerInfo: insertBannerInfo = (params) =>
    axios.post('/release/module/insertBannerInfo', params);

  // V1.0.1-banner-修改
  static updateBannerInfo: updateBannerInfo = (params) =>
    axios.post('/release/module/updateBannerInfo', params);

  // V1.0.1-banner批量删除
  static batchRemoveBannerInfo: batchRemoveBannerInfo = (params) =>
    axios.post('/release/module/batchRemoveBannerInfo', params);

  // V1.0.1-删除banner
  static removeBannerInfo: removeBannerInfo = (params) =>
    axios.get('/release/module/removeBannerInfo', { params });

  // V1.0.1-banner-排序交换
  static exchangeBannerInfo: exchangeBannerInfo = (params) =>
    axios.post('/release/module/exchangeBannerInfo', params);

  // 查询招标快讯列表-分页
  static releaseTenderNews: releaseTenderNews = (params) =>
    axios.get('/release/tender/news', { params });

  // 新增招标快讯
  static releaseTenderNewsAdd: releaseTenderNewsAdd = (params) =>
    axios.post('/release/tender/news', params);

  // 修改招标快讯
  static releaseTenderNewsUpdate: releaseTenderNewsUpdate = (params) =>
    axios.put('/release/tender/news', params);

  // 删除招标快讯
  static releaseTenderNewsDelete: releaseTenderNewsDelete = (params) =>
    axios.delete(`/release/tender/news/${params?.id}`);
}
