import { request } from '@/service/request';

// 查询云存储配置列表
export function listOssConfig(query: Api.SystemManage.OssConfigSearchParams) {
  return request<Api.SystemManage.OssConfigList>({
    url: '/system/oss/config/list',
    method: 'get',
    params: query
  });
}

// 查询云存储配置详细
export function getOssConfig(ossConfigId: Api.SystemManage.OssConfig['ossConfigId']) {
  return request<Api.SystemManage.OssConfig>({
    url: `/system/oss/config/${ossConfigId}`,
    method: 'get'
  });
}

// 新增云存储配置
export function addOssConfig(data: Api.SystemManage.OssConfig) {
  return request({
    url: '/system/oss/config',
    method: 'post',
    data
  });
}

// 修改云存储配置
export function updateOssConfig(data: Api.SystemManage.OssConfig) {
  return request({
    url: '/system/oss/config',
    method: 'put',
    data
  });
}

// 删除云存储配置
export function delOssConfig(ossConfigIds: Api.SystemManage.OssConfig['ossConfigId'][]) {
  return request({
    url: `/system/oss/config/${ossConfigIds}`,
    method: 'delete'
  });
}

// 用户状态修改
export function changeOssConfigStatus(
  ossConfigId: Api.SystemManage.OssConfig['ossConfigId'],
  status: Api.SystemManage.OssConfig['status'],
  configKey: Api.SystemManage.OssConfig['configKey']
) {
  return request({
    url: '/system/oss/config/changeStatus',
    method: 'put',
    data: {
      ossConfigId,
      status,
      configKey
    }
  });
}
