package cz.moneta.test.dsl.util.data.client;

import java.util.EnumSet;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

public enum EducationLevel {
    HIGHER("HIGHER", "4", "Vysokoškolské"),
    MIDDLE("MIDDLE", "3", "Střední"),
    BASIC("BASIC", "1", "Základní"),
    TECHNICAL("TECHNICAL", "2", "Odborné/učňovské"),
    OTHER("OTHER", "5", "Jiné");

    private final String apiValue;
    private final String hcisValue;
    private final String ufoValue;

    private static final Map<String, EducationLevel> UFO_VALUES_LOOKUP = EnumSet.allOf(EducationLevel.class).stream()
            .collect(Collectors.toMap(el -> el.ufoValue, Function.identity()));

    EducationLevel(String apiValue, String hcisValue, String ufoValue) {
        this.apiValue = apiValue;
        this.hcisValue = hcisValue;
        this.ufoValue = ufoValue;
    }

    public String getApiValue() {
        return apiValue;
    }

    public String getHCisValue() { return hcisValue;}

    public String getUfoValue() {
        return ufoValue;
    }

    public static EducationLevel getByUfoValue(String ufoValue) {
        return UFO_VALUES_LOOKUP.get(ufoValue);
    }
}
