const allFieldsHidden = {
  isServe: false, // 本人是否需要服务
  isTrain: false, //本人是否需要培训
  isWork: false, // 本人是否有就业意愿
  isReject: false, // 是否拒绝就业服务
  isJustCase: false, // 拒绝服务有无正当理由
  salary: false, // 期望薪资
  isExit: false, // 是否要退出
  workSkillOne: false, // 第一求职意愿
  workSkillTwo: false, // 第二求职意愿
  workPlace: false, // 就业区县
  exitReason: false, // 不退出原因
  isExitTitle: "是否退出",
  exitReasonTitle: "退出原因",
  rejectReason: false, // 拒绝服务理由
  rejectResonUrl: false, // 文件佐证资料上传
  regmanage: false, // 失业登记管理<按钮>
  PersonalBaseInfo: true // 个人基础信息修改<按钮>
};

const categoryVisibilityRules = {
  潜在可享受职业培训政策人员: form => {
    // const showTrain = form.isServe === 1; // 联动规则
    // 需要先全部隐藏，再打开需要的
    return {
      ...allFieldsHidden,
      isServe: true,
      regmanage: false,
      isTrain: false
    };
  },

  潜在登记失业人员: form => {
    const showServe = form.isWork === 1;
    const showTrain = showServe && form.isServe === 1;
    // const showInpute = showTrain && form.isTrain === 1;

    return {
      ...allFieldsHidden,
      isServe: showServe,
      isTrain: showTrain,
      isWork: true,
      salary: showTrain,
      workSkillOne: showTrain,
      workSkillTwo: showTrain,
      workPlace: showTrain
    };
  },

  潜在的就业困难退出人员: form => {
    const showExitReason = form.isExit === 0;
    const exitReasonTitle = form.isExit === 0 ? "不退出原因" : "退出原因";

    return {
      ...allFieldsHidden,
      isExit: true,
      exitReason: showExitReason,
      exitReasonTitle,
      isExitTitle: "是否应退出就业困难人群"
    };
  },

  潜在返乡未就业农村劳动力: form => {
    const showServe = form.isWork === 1;
    const showTrain = showServe && form.isServe === 1;

    return {
      ...allFieldsHidden,
      isServe: showServe,
      isTrain: showTrain,
      isWork: true,
      salary: showTrain,
      workSkillOne: showTrain,
      workSkillTwo: showTrain,
      workPlace: showTrain
    };
  },

  潜在就业困难人员: form => {
    const showServe = form.isWork === 1;
    const showTrain = showServe && form.isServe === 1;
    // const showInpute = showTrain && form.isTrain === 1;

    return {
      ...allFieldsHidden,
      isServe: showServe,
      isTrain: showTrain,
      isWork: true,
      salary: showTrain,
      workSkillOne: showTrain,
      workSkillTwo: showTrain,
      workPlace: showTrain
    };
  },

  潜在就业见习申请人员: form => {
    return {
      ...allFieldsHidden,
      isServe: true
    };
  },

  失业保险金申领人员: form => {
    const showReason = form.isReject === 1;

    return {
      ...allFieldsHidden,
      isReject: true,
      isJustCase: showReason,
      rejectReason: showReason,
      rejectResonUrl: showReason
    };
  },

  default: () => {
    return allFieldsHidden;
  }
};

export default categoryVisibilityRules;
