import request from '@/router/axios';

/**=======================分类管理api======================================================= */
/**获取所有分类列表 */
export const getRuleTypesList =
  () => {
    return request({
      url: '/api/jobslink-api/manager/group/getGroupAll',
      method: 'get',
    })
  }
/**新增一级分类 */
export const addRuleType =
  (fatherId, name, introduce, prompt, remarks) => {
    return request({
      url: '/api/jobslink-api/manager/group/save',
      method: 'POST',
      data: {
        fatherId, name, introduce, prompt, remarks
      }

    })
  }

/**新增二级分类 */
export const addSecondRuleType =
  (fatherId, name) => {
    return request({
      url: '/api/jobslink-api/manager/group/save',
      method: 'POST',
      data: {
        fatherId, name
      }

    })
  }

/**分类详情 */
export const ruleTypeDetail =
  (id) => {
    return request({
      url: '/api/jobslink-api/manager/group/detail/' + id,
      method: 'get',
    })
  }
/**修改（批量删除，批量修改，批量隐藏）分类 */
export const updateRuleType =
  (ids, status, isDeleted) => {
    return request({
      url: '/api/jobslink-api/manager/group/updateGroup',
      method: 'POST',
      data: {
        ids, status, isDeleted
      }

    })
  }
/**编辑分类信息 */
export const editTypeInfo =
  (ids, name, introduce, prompt) => {
    return request({
      url: '/api/jobslink-api/manager/group/updateGroup',
      method: 'POST',
      data: {
        ids, name, introduce, prompt
      }

    })
  }
/**删除分类 */
export const delRuleType = (ids, isDeleted) => {
  return request({
    url: '/api/jobslink-api/manager/group/updateGroup',
    method: 'POST',
    data: {
      ids, isDeleted
    }

  })
}

/**隐藏/显示分类 */
export const hideRuleType = (ids, status) => {
  return request({
    url: '/api/jobslink-api/manager/group/updateGroup',
    method: 'POST',
    data: {
      ids, status
    }

  })
}

/**分类上移下移 */
export const moveRuleType =
  (id, mobile, sort, fatherId) => {
    return request({
      url: '/api/jobslink-api/manager/group/mobile',
      method: 'POST',
      data: {
        id, mobile, sort, fatherId
      }

    })
  }

/**============================================制度管理api==================================== */
/**获取制度列表 */
export const getRulesList =
  (current, size, params) => {
    return request({
      url: '/api/jobslink-api/manager/rulesItem/getRulesItemVOList',
      method: 'get',
      params: {
        ...params,
        current,
        size
      }
    })
  }

/**新增制度 */
export const addRule =
  (firstId, secondId, docName, docUrl, docImage, status) => {
    return request({
      url: '/api/jobslink-api/manager/rulesItem/saveOrUpdate',
      method: 'post',
      data: {
        firstId, secondId, docName, docUrl, docImage, status
      }
    })
  }

/**制度详情 */
export const getRuleDetailInfo =
  (id) => {
    return request({
      url: '/api/jobslink-api/manager/rulesItem/getRulesItem/' + id,
      method: 'get',

    })
  }
/**编辑制度 */
export const editRule =
  (id, firstId, secondId, docName, docUrl, docImage, status) => {
    return request({
      url: '/api/jobslink-api/manager/rulesItem/saveOrUpdate',
      method: 'post',
      data: {
        id, firstId, secondId, docName, docUrl, docImage, status
      }
    })
  }
/**删除制度 */
export const delRules =
  (ids, isDeleted) => {
    return request({
      url: '/api/jobslink-api/manager/rulesItem/batch',
      method: 'post',
      data: {
        ids, isDeleted
      }
    })
  }

/**显示/隐藏制度 */
export const hideOrShowRules =
  (ids, status) => {
    return request({
      url: '/api/jobslink-api/manager/rulesItem/batch',
      method: 'post',
      data: {
        ids, status
      }
    })
  }

/**获取新增制度时，获取分类列表 */
export const ruleGetTypeList = (fatherId) => {

  return request({
    url: '/api/jobslink-api/manager/group/getGroupList/' + fatherId,
    type: 'get'
  })
}

/** */

/**==================================企业端获取制度列表信息api======================== */

export const getRulesItem =
  (groupId) => {
    return request({
      url: '/api/jobslink-api/manager/rulesItem/getRulesItemList/' + groupId,
      method: 'get',
    })
  }
