import { requestClient } from '#/api/request';

enum Api {
  root = '/wecom/tenant-config',
  test = '/wecom/tenant-config/test',
}

/**
 * 获取当前租户的企业微信配置
 */
export function getWecomConfig() {
  return requestClient.get(Api.root);
}

/**
 * 保存/更新企业微信配置
 */
export function saveWecomConfig(data: any) {
  return requestClient.put(Api.root, data);
}

/**
 * 测试企业微信连接
 */
export function testWecomConfig(corpid: string, corpsecret: string) {
  return requestClient.post(Api.test, null, {
    params: { corpid, corpsecret },
  });
}
