package com.sunyard.ssp.common.enums;

import com.sunyard.ssp.common.constant.CommonConstant;

public enum UserHeaderTypeEnum {
    HEADER_TYPE_MAIN(CommonConstant.HEADER_TYPE_MAIN,"main"),
    HEADER_TYPE_VICE(CommonConstant.HEADER_TYPE_VICE,"vice"),
    HEADER_TYPE_NONE(CommonConstant.HEADER_TYPE_NONE,"none")
    ;

    private Integer key;
    private String name;

    UserHeaderTypeEnum(Integer statusKey, String statusName) {
        this.key = statusKey;
        this.name = statusName;
    }

    public Integer getKey() {
        return key;
    }

    public void setKey(Integer key) {
        this.key = key;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static String getNameByKey(Integer key){
        for (UserHeaderTypeEnum applicationStatus : UserHeaderTypeEnum.values()) {
            if(applicationStatus.getKey().equals(key)){
                return applicationStatus.getName();
            }
        }
        return null;
    }

    public static Integer getKeyByName(String name){
        for (UserHeaderTypeEnum applicationStatus : UserHeaderTypeEnum.values()) {
            if(applicationStatus.getName().equals(name)){
                return applicationStatus.getKey();
            }
        }
        return null;
    }
}
