package com.ssj.enums;

/**
 * 服务描述
 *
 * @author Mount Liu
 * @date 2019-12-25
 */
public enum ServiceEnum {

    //C001年卡C002半年卡C003月卡C004作业吧月卡C005作业吧半年卡C006作业吧年卡C015季度卡"C023"机构购买平台服务“C024”校区服务
    YEAR_PLATFORM("C006", "年度平台服务"),
    MONTH_PLATFORM("C004", "月度平台服务"),
    HALF_YEAR_PLATFORM("C005", "半年平台服务"),
    //1平台服务（家长购买），2校区服务，4平台服务（机构购买）
    PLAT_SERVICE_USER(1, "平台服务(家长购买)"),
    LIB_SERVICE(2, "校区服务"),
    PLAT_SERVICE_LIB(4, "平台服务"),
    LIB_CORRECT_SERVICE(5, "批改服务");


    private String type;
    private int serviceType;
    private String name;

    ServiceEnum(String type, String name) {
        this.type = type;
        this.name = name;
    }

    ServiceEnum(int serviceType, String name) {
        this.serviceType = serviceType;
        this.name = name;
    }

    public String getType() {
        return type;
    }

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

    public String getName() {
        return name;
    }

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

    public int getServiceType() {
        return serviceType;
    }

    public void setServiceType(int serviceType) {
        this.serviceType = serviceType;
    }

    public static String getName(String type) {
        for (ServiceEnum service : values()) {
            if (service.getType().equals(type)) {
                return service.getName();
            }
        }
        return null;
    }

    public static String getName(int serviceType) {
        for (ServiceEnum service : values()) {
            if (service.getServiceType() == serviceType) {
                return service.getName();
            }
        }
        return null;
    }

}
