package click.kamil.springstatemachineexporter.model;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;
import java.util.Optional;

@Getter
@RequiredArgsConstructor
public enum TransitionType {
    EXTERNAL("withExternal"),
    INTERNAL("withInternal"),
    LOCAL("withLocal"),
    FORK("withFork"),
    JOIN("withJoin"),
    CHOICE("withChoice"),
    JUNCTION("withJunction");

    private final String methodName;

    public static Optional<TransitionType> fromMethodName(String methodName) {
        return Arrays.stream(values())
                .filter(t -> t.methodName.equals(methodName))
                .findFirst();
    }
}
