<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace app\common\state;

/**
 * Description of AllowanceProjectEnum
 *
 * @author sgq
 */
class AllowanceProjectEnum {

    //项目-合同
    const PROJECT_CONTRACT = 1;
    //项目-个税
    const PROJECT_TAX = 2;
    //项目-工资
    const PROJECT_WAGES = 3;
    //项目-考勤
    const PROJECT_ATTENDANCE = 4;
    //项目-授课计划
    const PROJECT_TEACHING = 5;
    //项目-备课教案
    const PROJECT_LESSON = 6;
    //项目-科研计划
    const PROJECT_SCIENTIFIC = 7;
    //项目-行政介绍信
    const PROJECT_LETTER = 8;
    //项目-社保
    const PROJECT_SB = 9;
    //项目-社保-养老保险
    const PROJECT_SB_PENSION = 10;
    //项目-社保-工伤保险
    const PROJECT_SB_INJURY = 11;
    //项目-社保-失业保险
    const PROJECT_SB_UNEMPLOYMENT = 12;
    //项目-社保-医疗保险
    const PROJECT_SB_MEDICA = 13;
    //项目-社保-生育保险
    const PROJECT_SB_BIRTH = 14;
    //项目-在境时间
    const PROJECT_INBORDER = 15;
    //项目-工作日时间
    const PROJECT_WORKDAY = 16;
    //项目-培养计划
    const PROJECT_TRAINING_PROGRAM = 17;
    //合同满足两年
    const CONTRACT_YES = "是";
    //合同满足两年
    const CONTRACT_NO = "否";

    static function getProjectName($code) {
        switch ($code) {
            case self::PROJECT_CONTRACT:
                return "劳动合同情况";
            case self::PROJECT_TAX:
                return "个税缴纳情况";
            case self::PROJECT_WAGES:
                return "工资发放情况";
            case self::PROJECT_ATTENDANCE:
                return "考勤情况";
            case self::PROJECT_TEACHING:
                return "授课计划/培养计划";
            case self::PROJECT_LESSON:
                return "备课教案";
            case self::PROJECT_SCIENTIFIC:
                return "科研计划情况";
            case self::PROJECT_LETTER:
                return "行政介绍信情况";
            case self::PROJECT_SB:
                return "社保缴纳情况";
            case self::PROJECT_SB_PENSION:
                return "养老保险情况";
            case self::PROJECT_SB_INJURY:
                return "工伤保险情况";
            case self::PROJECT_SB_UNEMPLOYMENT:
                return "失业保险情况";
            case self::PROJECT_SB_MEDICA:
                return "医疗保险情况";
            case self::PROJECT_SB_BIRTH:
                return "生育保险情况";
            case self::PROJECT_INBORDER:
                return "在境内时间";
            case self::PROJECT_WORKDAY:
                return "在境工作日";
            case self::PROJECT_TRAINING_PROGRAM:
                return "科研计划";
            default:
                return "";
        }
    }

    static function getProjectsByEnterpriseType($type, $enterpriseId = 0) {
        $projects = [];
        if ($type == CommonConst::ENTERPRISE_WJ) {
            $projects = [
                self::PROJECT_TAX,
                self::PROJECT_ATTENDANCE,
                self::PROJECT_SB_PENSION
            ];
        } else if ($type == CommonConst::ENTERPRISE_GJ) {
            $projects = [
                self::PROJECT_SB_PENSION,
                self::PROJECT_TAX,
                self::PROJECT_WAGES,
                self::PROJECT_ATTENDANCE

            ];
        } else {
            $projects = [
                self::PROJECT_TAX,
                self::PROJECT_WAGES,
                self::PROJECT_ATTENDANCE,
                self::PROJECT_SB_PENSION,
                self::PROJECT_SB_UNEMPLOYMENT,
                self::PROJECT_SB_MEDICA
            ];
        }

        $extraProjects = getJsonConfig("../sys_config.json", "talent_allowance_need_extra_project");
        if ($enterpriseId && $extraProjects[$enterpriseId]) {
            $projects = array_unique(array_merge($projects, $extraProjects[$enterpriseId]));
        }

        return $projects;
    }

}
