import request from '@/utils/http';
import http from '@/utils/request';

//获取token
export function getZhiHuiToken(data) {
  console.log("🚀 ~ getZhiHuiToken ~ data:", data)
  return http({
    url: '/front/zhihui/getToken',
    method: 'post',
    data: { appid: import.meta.env.VITE_APP_ZHI_HUI_APPID, channel: import.meta.env.VITE_APP_ZHI_HUI_CHANHEL, ...data },
  });
}
/**
 * 获取sign
 * @param {*} data
 * @returns
 */
export function getZhiHuiSign(data) {
  return http({
    url: '/front/zhihui/getSig',
    method: 'post',
    data,
  });
}
/**
 * 更新用户信息
 * @param {*} data
 * @returns
 */
export function updateUserInfo(data) {
  return http({
    url: '/front/zhihui/updateUserInfo',
    method: 'post',
    data,
  });
}
/**
 * 获取用户Id
 * @param {*} data
 * @returns
 */
export function getUserId(data) {
  return http({
    url: '/front/zhihui/getUserIdByName',
    method: 'post',
    data,
  });
}
export function getUserByZhId(data) {
  return http({
    url: '/front/zhihui/getUserByZhId',
    method: 'post',
    data,
  });
}
/**
 * 保存团队信息
 * @param {*} data
 * @returns
 */
export function saveGroup(data) {
  return http({
    url: '/front/zhihui/saveGroup',
    method: 'post',
    data,
  });
}
/**
 * 更新团队信息
 * @param {*} data
 * @returns
 */
export function updateGroup(data) {
  return http({
    url: '/front/zhihui/updateGroup',
    method: 'post',
    data,
  });
}
//腾讯接口
/**
 * appid创建企业
 * @returns
 */
export function createCompany(data) {
  return request({
    url: '/account/api/auth/app/create-company',
    method: 'post',
    data,
  });
}
/**
 * 创建个人企业
 * @param {*} data
 * @returns
 */
export function createPersonCompany(data) {
  return request({
    url: '/account/api/auth/create-company',
    method: 'post',
    data,
  });
}
export function getCompany(data) {
  return request({
    url: '/account/api/auth/app/company',
    method: 'post',
    data,
  });
}
/**
 *
 * @param {*} data :{filter,hideObjects,filterTermArr,pageNumber,pageSize,sort}
 * @description 获取模板列表
 * @returns
 */
export function listTemplate(data) {
  return request({
    url: 'middle-material/template/apollo/list',
    method: 'post',
    data: data,
  });
}
/**
 * 获取团队模板
 * @param {*} data
 * @returns
 */
export function getTemplate(data) {
  return request({
    url: 'middle-material/team-template/find-by-team',
    method: 'post',
    data,
  });
}
/**
 * 更新模板
 * @param {*} data
 * @returns
 */
export function updateTemplate(data) {
  return request({
    url: 'middle-material/team-template',
    method: 'PATCH',
    data,
  });
}
/**
 * 删除模板
 * @param {*} data
 * @returns
 */
export function delTemplate(data) {
  return request({
    url: 'middle-material/team-template/del',
    method: 'post',
    data,
  });
}
/**
 *
 * @param {*} data
 * @description 获取模板分类全局
 * @returns
 */
export function listApollo() {
  return request({
    url: 'middle-material/terms/apollo/list',
    method: 'get',
  });
}
/**
 * 获取分类
 * @param {*} data
 * @returns
 */
export function listApolloByTeam(data) {
  return request({
    url: 'middle-material/category-common/query-tree',
    method: 'post',
    data,
  });
}
/**
 * psd解析
 * @returns
 */
export function uploadParseOnly(data) {
  return request({
    url: 'atom-parser/psd/upload-parse-only',
    method: 'post',
    data,
  });
}
/**
 * 上传到团队模板
 * @param {} data
 * @returns
 */
export function templateUpload(data) {
  return request({
    url: 'middle-material/template/upload',
    method: 'post',
    data,
  });
}
/**
 * 获取团队信息
 * @param {*} data
 * @returns
 */
export function getGroupInfo(data) {
  return request({
    url: 'account/api/auth/team',
    method: 'post',
    data,
  });
}
/**
 * 获取信息
 * @param {*} data
 * @returns
 */
export function getGroupInfoById(data) {
  return request({
    url: 'bll-apollo/team',
    method: 'post',
    data,
  });
}
/**
 * 获取个人信息
 * @param {*} data
 * @returns
 */
export function getProfile(data) {
  return request({
    url: 'account/api/auth/profile',
    method: 'post',
    data,
  });
}
/**
 * 修改团队信息
 * @param {*} data
 * @returns
 */
export function updateGroupInfo(data) {
  return request({
    url: 'account/api/auth/update-team',
    method: 'post',
    data,
  });
}
/**
 * 获取团队成员
 * @param {*} data
 * @returns
 */
export function getGroupMembers(data) {
  return request({
    url: 'account/api/auth/team-user',
    method: 'post',
    data,
  });
}
/**
 * 移除团队成员
 */
export function removeGroupMember(data) {
  return request({
    url: 'account/api/auth/app/team-remove-user',
    method: 'post',
    data,
  });
}
/**
 * 加入指定团队
 */
export function initGroup(data) {
  return request({
    url: 'account/api/auth/app/join-team',
    method: 'post',
    data,
  });
}
/**
 * 应用层更新信息
 * @param {*} data
 * @returns
 */
export function updateGroupInfoApp(data) {
  return request({
    url: 'account/api/auth/app/update-company',
    method: 'post',
    data,
  });
}

/**
 * 加入企业
 * @param {*} data
 * @returns
 */
export function joinCompany(data) {
  return request({
    url: 'account/api/auth/app/join-company',
    method: 'post',
    data,
  });
}
/**
 * 创建团队
 * @param {*} data
 * @returns
 */
export function createGroup(data) {
  return request({
    url: 'account/api/auth/create-team',
    method: 'post',
    data,
  });
}
/**
 * 创建分类
 * @param {*} data
 * @returns
 */
export function createCategory(data) {
  return request({
    url: 'middle-material/category',
    method: 'post',
    data,
  });
}
/**
 * 更新分类
 * @param {*} data
 * @param {*} id
 * @returns
 */
export function updateCategory(data, id) {
  return request({
    url: 'middle-material/category/' + id,
    method: 'PATCH',
    data,
  });
}
/**
 * 删除分类
 * @param {*} data
 * @param {*} id
 * @returns
 */
export function deleteCategory(data, id) {
  return request({
    url: 'middle-material/category/' + id,
    method: 'DELETE',
    data,
  });
}
/**
 * 团队素材新增
 * @param {*} data
 * @returns
 */
export function addGroupMraw(data) {
  return request({
    url: 'middle-material/mraw/upload',
    method: 'post',
    data,
  });
}
/**
 * 团队素材查询
 * @param {*} data
 * @returns
 */
export function getGroupMraw(data) {
  return request({
    url: '/middle-material/team-mraw/find-by-team',
    method: 'post',
    data,
  });
}
/**
 * 获取团队字体
 * @param {*} data
 * @returns
 */
export function getGroupFront(data) {
  return request({
    url: '/middle-material/font/list-private',
    method: 'post',
    data,
  });
}
/**
 * 删除团队字体
 * @param {*} data
 * @returns
 */
export function delGroupFront(data) {
  return request({
    url: '/middle-material/font/private-delete',
    method: 'post',
    data,
  });
}
/**
 * 更新团队字体
 * @param {*} data
 * @returns
 */
export function updateGroupFront(data) {
  return request({
    url: '/middle-material/team-font',
    method: 'PATCH',
    data,
  });
}
/**
 * 获取团队标签
 * @param {*} data
 * @returns
 */
export function getGroupLabel(data) {
  return request({
    url: 'middle-material/label/enterprise/query-tree',
    method: 'post',
    data,
  });
}
/**
 * 创建团队标签
 * @param {*} data
 * @returns
 */
export function createGroupLabel(data) {
  return request({
    url: 'middle-material/label/enterprise/create',
    method: 'post',
    data,
  });
}
/**
 * 图片转pdf
 * @param {*} data
 * @returns
 */
export function imageRenderPdf(data) {
  return request({
    url: 'pdf/render/image-pdf',
    method: 'POST',
    data,
    headers: {
      'content-type': 'multipart/form-data',
    },
  });
}
/**
 * 获取模板可编辑字段
 * @param {*} id
 * @param {*} data
 * @returns
 */
export function getTemplatInputer(id, data) {
  return request({
    url: 'middle-material/template/template-inputer/' + id,
    method: 'post',
    data,
  });
}
/**
 * 替换模版内容合成图片
 * @param {*} data
 * @returns
 */
export function templateRenderFree(data) {
  return request({
    url: 'bll-smart-image/images/template-render-free',
    method: 'post',
    data,
  });
}
/**
 * 获取模板信息
 * @param {*} id
 * @returns
 */
export function getTemplateInfo(id) {
  return request({
    url: 'middle-material/template/' + id,
    method: 'get',
  });
}
