package io.delphiplatform.api.v3.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * Specific term to aggregate the data (e.g. streams) on
 */
public enum AggBy {

    ARTIST("artist"),

    ISRC("isrc");

    private final String value;

    AggBy(String value) {
        this.value = value;
    }

    @JsonCreator
    public static AggBy fromValue(String value) {
        for (AggBy b : AggBy.values()) {
            if (b.value.equals(value)) {
                return b;
            }
        }
        throw new IllegalArgumentException("Unexpected value '" + value + "'");
    }

    @JsonValue
    public String getValue() {
        return value;
    }

    @Override
    public String toString() {
        return String.valueOf(value);
    }
}
