import request from "@/router/axios";
import {validatenull} from "@/util/validate";
/*获取行业类型*/
export const getTrade = companyId => {
  return new Promise(function (resolve, reject) {
    request({
      url: "/api/jobslink-api/tenant/trade/base/all",
      method: "get",
      params: {companyId}
    })
      .then(resp => {
        const data = validatenull(resp.data.data) ? [] : resp.data.data;
        resolve(data);
      })
      .catch(reject);
  });
};

/*根据行业类型获取工种*/
export const getWork = tradeId => {
  return new Promise(function (resolve, reject) {
    request({
      url: "/api/jobslink-api/tenant/worktypes/base/getlist",
      method: "get",
      params: {tradeId}
    })
      .then(resp => {
        const data = validatenull(resp.data.data) ? [] : resp.data.data;
        resolve(data);
      })
      .catch(reject);
  });
};

/*根据工种获取技能列表*/
export const getSkillList = worktypesId => {
  return request({
    url: "/api/jobslink-api/tenant/skills/base/list",
    method: "get",
    params: {
      worktypesId
    }
  });
};

/*获取企业工种*/
export const getWorkTypes = type => {
  return request({
    url: "/api/jobslink-api/tenant/worktypes/base/list",
    method: "get",
    params: {
      type
    }
  });
};
/*获取标签列表*/
export const getLabelList = () => {
  return request({
    url: "/api/jobslink-api/label/listAll",
    method: "get"
    // params: {
    //   type
    // }
  });
};
