import request from '@/utils/request'

// 查询租户基础信息列表
export function listTenant(query) {
  return request({
    url: '/tenant/tenant/list',
    method: 'get',
    params: query
  })
}

// 查询所有租户id以及租户名称 租户编码
export function tenantList(query) {
  return request({
    url: '/tenant/tenant/tenantList',
    method: 'get',
    params: query
  })
}

// 查询租户基础信息详细
export function getTenant(id) {
  return request({
    url: '/tenant/tenant/' + id,
    method: 'get'
  })
}

// 新增租户基础信息
export function addTenant(data) {
  return request({
    url: '/tenant/tenant',
    method: 'post',
    data: data
  })
}

// 修改租户基础信息
export function updateTenant(data) {
  return request({
    url: '/tenant/tenant',
    method: 'put',
    data: data
  })
}

// 删除租户基础信息
export function delTenant(id) {
  return request({
    url: '/tenant/tenant/' + id,
    method: 'delete'
  })
}

// 导出租户基础信息
export function exportTenant(query) {
  return request({
    url: '/tenant/tenant/export',
    method: 'get',
    params: query
  })
}

export function roleMenuTreeselect(data) {
  return request({
    url: '/tenant/tenant/menu',
    method: 'post',
    data: data
  })
}

export function menuEdit(data) {
  return request({
    url: '/tenant/tenant/menu/edit',
    method: 'post',
    data: data
  })
}

// 查询租户配置
export function getTenantConfigByKey(configKey, id) {
  return request({
    url: '/tenant/tenant/getConfigByKey/' + configKey,
    method: 'get',
    params: { id }
  })
}

// 修改租户配置
export function editTenantConfig(data) {
  return request({
    url: '/tenant/tenant/config/edit',
    method: 'post',
    data: data
  })
}
