// @ts-ignore
/* eslint-disable */
import request from '@repo/api-client'

/** 检查存储引擎连通性 POST /api/ai/storage-provider/check */
export async function postStorageProviderCheck(
  body: {
    provider: string
    config: {
      access_key_id: string
      bucket_name: string
      endpoint: string
      mode: string
      path_prefix: string
      provider: string
      secret_access_key: string
      use_ssl: boolean
    }
  },
  options?: { [key: string]: any }
) {
  return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
    '/api/ai/storage-provider/check',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {})
    }
  )
}

/** 获取配置信息 POST /api/ai/storage-provider/config */
export async function postStorageProviderConfig(
  body: {
    name: string
  },
  options?: { [key: string]: any }
) {
  return request<{
    isSuccess: boolean
    code: number
    result: {
      access_key_id: string
      mode: string
      endpoint: string
      provider: string
      use_ssl: boolean
      bucket_name: string
      secret_access_key: string
      path_prefix: string
    }
    isAuthorized: boolean
  }>('/api/ai/storage-provider/config', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  })
}

/** 获取默认存储厂商 POST /api/ai/storage-provider/default-provider */
export async function postStorageProviderDefaultProvider(
  body: {},
  options?: { [key: string]: any }
) {
  return request<{ isSuccess: boolean; code: number; isAuthorized: boolean; result?: string }>(
    '/api/ai/storage-provider/default-provider',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {})
    }
  )
}

/** 获取支持的引擎列表 POST /api/ai/storage-provider/engines */
export async function postStorageProviderEngines(body: {}, options?: { [key: string]: any }) {
  return request<{
    isSuccess: boolean
    code: number
    result: { allowed: boolean; available: boolean; description: string; name: string }[]
    isAuthorized: boolean
  }>('/api/ai/storage-provider/engines', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  })
}

/** 初始化存储厂商信息 POST /api/ai/storage-provider/initStorageProvider */
export async function postStorageProviderInitStorageProvider(
  body: {},
  options?: { [key: string]: any }
) {
  return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
    '/api/ai/storage-provider/initStorageProvider',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {})
    }
  )
}

/** 更新配置信息 POST /api/ai/storage-provider/update */
export async function postStorageProviderUpdate(
  body: {
    default_provider: string
    cos: {
      app_id: string
      bucket_name: string
      path_prefix: string
      provider: string
      region: string
      secret_id: string
      secret_key: string
    }
    local: { path_prefix: string; provider: string }
    minio: {
      access_key_id: string
      bucket_name: string
      endpoint: string
      mode: string
      path_prefix: string
      provider: string
      secret_access_key: string
      use_ssl: boolean
    }
    oss: {
      access_key: string
      bucket_name: string
      endpoint: string
      path_prefix: string
      provider: string
      region: string
      secret_key: string
      temp_bucket_name: string
      temp_region: string
      use_temp_bucket: boolean
    }
    s3: {
      access_key: string
      bucket_name: string
      endpoint: string
      path_prefix: string
      provider: string
      region: string
      secret_key: string
    }
    tos: {
      access_key: string
      bucket_name: string
      endpoint: string
      path_prefix: string
      provider: string
      region: string
      secret_key: string
    }
  },
  options?: { [key: string]: any }
) {
  return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
    '/api/ai/storage-provider/update',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {})
    }
  )
}

/** 更新默认存储厂商 POST /api/ai/storage-provider/updateDefaultProvider */
export async function postStorageProviderUpdateDefaultProvider(
  body: {
    provider: string
  },
  options?: { [key: string]: any }
) {
  return request<{ isSuccess: boolean; code: number; isAuthorized: boolean }>(
    '/api/ai/storage-provider/updateDefaultProvider',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {})
    }
  )
}
