package com.mvc.constant;

/**
 * 燃气表规格
 */
public enum GasMeterSpec {
    //SPEC_1_6("G1.6",1.6, 2.5, 0.016, 0.25, 3, 3),
    SPEC_1_6("G1.6",1.6, 3, 0.016, 0.25, 3, 3),//2.5->3 (配置表口径是int)
    SPEC_2_5("G2.5",2.5, 4, 0.025, 0.4, 5, 4.8),
    SPEC_4("G4",4D, 6, 0.04, 0.6, 5, 7.2),
    SPEC_6("G6",6D, 10, 0.06, 1, 8, 12),
    SPEC_10("G10",10D, 16, 0.1, 1.6, 13, 19.2),
    SPEC_16("G16",16D, 25, 0.16, 2.5, 13, 30),
    SPEC_25("G25",25D, 40, 0.25, 4, 20, 48),
    SPEC_40("G40",40D, 65, 0.4, 6.5, 32, 78),
    SPEC_65("G65",65D, 100, 0.65, 10, 32, 120),
    SPEC_100("G100",100D, 160, 1, 16, 50, 192);

    /**
     * 名称
     */
    private String name;
    /**
     * 规格
     */
    private Double spec;

    /**
     * 最大流量(m³/h)
     * qMax(取自表上名称)
     */
    private Double qmax;

    /**
     * 最小流量(m³/h)
     * qMin(取自表上名称)
     */
    private Double qmin;

    /**
     * 分界流量(m³/h)
     * Divergence Flow Rate
     */
    private Double dfr;

    /**
     * 始动流量最大值(dm³/h)
     * Maximum Start Flow Rate
     */
    private Double msfr;

    /**
     * 过载流量(m³/h)
     * Overload Flow Rate
     */
    private Double ofr;

    GasMeterSpec(String name, Double spec, double qmax, double qmin, double dfr, double msfr, double ofr) {
        this.name = name;
        this.spec = spec;
        this.qmax = qmax;
        this.qmin = qmin;
        this.dfr = dfr;
        this.msfr = msfr;
        this.ofr = ofr;
    }

    /**
     * 根据配置参数中的最大流量匹配燃气表规格
     * @param qMax
     * @return
     */
    public static GasMeterSpec findGasMeterSpecByQMax(int qMax) {
        for (GasMeterSpec gasMeterSpec : GasMeterSpec.values()) {
            if (gasMeterSpec.qmax == qMax) {
                return gasMeterSpec;
            }
        }
        return null;
    }

    public String getName() {
        return name;
    }

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

    public Double getSpec() {
        return spec;
    }

    public void setSpec(Double spec) {
        this.spec = spec;
    }

    public Double getQmax() {
        return qmax;
    }

    public void setQmax(Double qmax) {
        this.qmax = qmax;
    }

    public Double getQmin() {
        return qmin;
    }

    public void setQmin(Double qmin) {
        this.qmin = qmin;
    }

    public Double getDfr() {
        return dfr;
    }

    public void setDfr(Double dfr) {
        this.dfr = dfr;
    }

    public Double getMsfr() {
        return msfr;
    }

    public void setMsfr(Double msfr) {
        this.msfr = msfr;
    }

    public Double getOfr() {
        return ofr;
    }

    public void setOfr(Double ofr) {
        this.ofr = ofr;
    }
}
