/*
 * Copyright (c) 2024 LangChat. TyCoding All Rights Reserved.
 *
 * Licensed under the GNU Affero General Public License, Version 3 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    https://www.gnu.org/licenses/agpl-3.0.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import request from '@/config/axios'

// AI 应用管理 API
export const AppApiManagement = {
  // 获取API列表
  getApiList: async (params: any) => {
    return await request.get({ url: '/aigc/app/api/list', params })
  },

  // 获取API分页数据
  getApiPage: async (params: any) => {
    return await request.get({ url: '/aigc/app/api/page', params })
  },

  // 获取API详情
  getApi: async (id: string) => {
    return await request.get({ url: `/aigc/app/api/${id}` })
  },

  // 新增API
  createApi: async (data: any) => {
    return await request.post({ url: '/aigc/app/api', data })
  },

  // 更新API
  updateApi: async (data: any) => {
    return await request.put({ url: '/aigc/app/api', data })
  },

  // 删除API
  deleteApi: async (id: string) => {
    return await request.delete({ url: `/aigc/app/api/${id}` })
  },

  // 发布API
  publishApi: async (id: string) => {
    return await request.put({ url: `/aigc/app/api/publish/${id}` })
  },

  // 下线API
  offlineApi: async (id: string) => {
    return await request.put({ url: `/aigc/app/api/offline/${id}` })
  }
}
