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 MaritalStatus {
    SINGLE("SINGLE", "1", "svobodný/svobodná", "Svobodný(á)"),
    MARRIED("MARRIED", "2", "ženatý/vdaná", "Ženatý/vdaná"),
    PARTNER("PARTNER", "3", "druh/družka", "Registrované partnerství"),
    WIDOWED("WIDOWED", "4", "vdovec/vdova", "Vdovec/vdova"),
    DIVORCED("DIVORCED", "5", "rozvedený/rozvedená", "Rozvedený(á)");

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

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

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

    public String getApiValue() {
        return apiValue;
    }

    public String getHCisValue() {
        return hcisValue;
    }

    public String getUfoValue() {
        return ufoValue;
    }

    public String getHyposValue() {
        return hyposValue;
    }

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

}
