from utils.options import *

keys = {
    "ifat": 0,
    "if": 0,
    "f": 0,
    "isat": 1,
    "(i)sat": 1,
    "is": 1,
    "s": 1,
    "all": 2,
    "a": 2,
}


def validatedPhaseInput():
    inputPhase = None
    while inputPhase is None:
        printOptions()
        inputPhase = input()

        if inputPhase.isnumeric():
            inputPhase = int(inputPhase)
            if inputPhase not in range(len(inputPhases)):
                print("\n", inputPhase, "is not a valid option")
                inputPhase = None
            else:
                return inputPhases[inputPhase]
        else:
            inputPhase = inputPhase.lower()
            if inputPhase not in keys:
                print("\n", inputPhase, "is not a valid option")
                inputPhase = None
            else:
                return inputPhases[keys[inputPhase]]

    print(
        "Something went seriously wrong, please consult the maintainer of the codebase."
    )
    return inputPhase