package org.linlinjava.jz.db.util.hm;

public enum HmEmployClockEnum {

    // 0未打卡，1上班，2下班，3请假,4到了时间就缺勤,
//	public static int STATUS_0=0;
//	public static int STATUS_1=1;
//	public static int STATUS_2=2;
//	public static int STATUS_3=3;
    STATUS_0(0, "未打卡"), STATUS_1(1, "上班打卡"), STATUS_2(2, "服务已完成"), STATUS_3(3, "发起请假"), STATUS_4(4, "请假中"), STATUS_5(5, "缺勤");

    public static int APPROVAL_STATE_0 = 0;// 请假待审批
    public static int APPROVAL_STATE_1 = 1;// 请假审批通过
    public static int APPROVAL_STATE_2 = 2;// 请假审批未通过
    public static int APPROVAL_STATE_3 = 3;// 无

    private int type;
    private String typeName;

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    private HmEmployClockEnum(int type, String typeName) {
        this.type = type;
        this.typeName = typeName;
    }

    /**
     * 打卡状态
     *
     * @param type
     * @return
     */
    public static String getTypeName(int type) {
        for (HmEmployClockEnum s : HmEmployClockEnum.values()) {
            if (s.getType() == type) {
                return s.getTypeName();
            }
        }
        return null;
    }

    /**
     * 请假状态
     *
     * @param state         打卡状态
     * @param approvalState 请假状态
     * @return
     */
    public static String getApprovalStateName(int state, int approvalState) {

        if (state != HmEmployClockEnum.STATUS_3.type) {
            return null;
        }

        if (APPROVAL_STATE_0 == approvalState) {
            return "请假--待审批";
        }
        if (APPROVAL_STATE_1 == approvalState) {
            return "请假--审批通过";
        }
        if (APPROVAL_STATE_2 == approvalState) {
            return "请假--审批未通过";
        }

        return null;

    }

}
