package com.example.fitbot.exercise;

public enum EMuscleGroup {
    // TODO: Implement

    TORSO(0, new String[]{"upper body", "torso"}),
    ARMS(1, new String[]{"arms", "arm", "shoulder"}),
    LEGS(2, new String[]{"Lower body", "legs", "leg"});

    int muscleGroupIdentifier;
    String[] muscleGroupNames;

    EMuscleGroup(int identifier, String[] muscleGroupNames) {
        this.muscleGroupIdentifier = identifier;
        this.muscleGroupNames = muscleGroupNames;
    }

    public int getIdentifier() {
        return this.muscleGroupIdentifier;
    }

    public static EMuscleGroup parse(String name) {
        for (EMuscleGroup muscleGroup : EMuscleGroup.values())
            for (String muscleGroupName : muscleGroup.muscleGroupNames)
                if (muscleGroupName.equalsIgnoreCase(name))
                    return muscleGroup;
        return null;
    }

    public static EMuscleGroup parse(int identifier) {
        for (EMuscleGroup muscleGroup : EMuscleGroup.values()) {
            if (muscleGroup.getIdentifier() == identifier) {
                return muscleGroup;
            }
        }
        return null;
    }

}
