import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SiteSettingVO, SiteSettingForm, SiteSettingQuery } from '@/api/setting/siteSetting/types';

/**
 * 查询站点设置列表
 * @param query
 * @returns {*}
 */

export const listSiteSetting = (query?: SiteSettingQuery): AxiosPromise<SiteSettingVO[]> => {
  return request({
    url: '/system/siteSetting/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询站点设置详细
 * @param id
 */
export const getSiteSetting = (id: string | number): AxiosPromise<SiteSettingVO> => {
  return request({
    url: '/system/siteSetting/' + id,
    method: 'get'
  });
};

/**
 * 新增站点设置
 * @param data
 */
export const addSiteSetting = (data: SiteSettingForm) => {
  return request({
    url: '/system/siteSetting',
    method: 'post',
    data: data
  });
};

/**
 * 修改站点设置
 * @param data
 */
export const updateSiteSetting = (data: SiteSettingForm) => {
  return request({
    url: '/system/siteSetting',
    method: 'put',
    data: data
  });
};

export const getSiteSettingData = (): AxiosPromise<SiteSettingVO> => {
  return request({
    url: '/system/siteSetting/getSiteSettingData',
    method: 'get'
  });
};

/**
 * 删除站点设置
 * @param id
 */
export const delSiteSetting = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/siteSetting/' + id,
    method: 'delete'
  });
};
