package info.knacki.prometheusandroidexporter;

import androidx.annotation.NonNull;

public class CollectorValue {
    public static class Type {
        public final String fName;
        private Type(String name) { this.fName = name; }

        public final static Type COUNTER = new Type("counter");
        public final static Type GAUGE = new Type("gauge");
        public final static Type SUMMARY = new Type("summary");
    }

    public final String fName;
    public final String fHelp;
    public final Type fType;
    private String valueAsString;

    public CollectorValue(String name, String help, Type type) {
        fName = name;
        fHelp = help;
        fType = type;
    }

    public CollectorValue(CollectorValue other) {
        fName = other.fName;
        fHelp = other.fHelp;
        fType = other.fType;
    }

    public void SetValue(String value) {
        valueAsString = value;
    }

    public void SetValue(double value) {
        valueAsString = Double.toString(value);
    }

    @NonNull
    @Override
    public String toString() {
        return valueAsString;
    }
}
