import { http2 } from "@/utils/request.js"

// ========== 配置组管理 ==========

/** 获取配置分组列表 */
export const getSettingGroupList = (params) => {
  return http2.get('/api/v1/admin/server/setting/group/list', { params })
}

/** 获取配置分组信息 */
export const getSettingGroupInfo = (params) => {
  return http2.get('/api/v1/admin/server/setting/group/info', { params })
}

/** 创建配置分组 */
export const createSettingGroup = (data) => {
  return http2.post('/api/v1/admin/server/setting/group/create', data, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

/** 修改配置分组 */
export const updateSettingGroup = (data) => {
  return http2.post('/api/v1/admin/server/setting/group/update', data, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

/** 删除配置分组 */
export const deleteSettingGroup = (params) => {
  return http2.delete('/api/v1/admin/server/setting/group/delete', { params })
}

// ========== 配置管理 ==========

/** 获取配置列表 */
export const getSettingList = (params) => {
  return http2.get('/api/v1/admin/server/setting/list', { params })
}

/** 获取配置信息 */
export const getSettingInfo = (params) => {
  return http2.get('/api/v1/admin/server/setting/info', { params })
}

/** 创建配置 */
export const createSetting = (data) => {
  return http2.post('/api/v1/admin/server/setting/create', data, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

/** 修改配置 */
export const updateSetting = (data) => {
  return http2.post('/api/v1/admin/server/setting/update', data, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

/** 修改配置是否开放访问 */
export const setSettingOpen = (data) => {
  return http2.post('/api/v1/admin/server/setting/set_open', data, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

/** 删除配置 */
export const deleteSetting = (data) => {
  return http2.delete('/api/v1/admin/server/setting/delete', {
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

