package org.raddatz.familienarchiv.person.relationship;

/**
 * Abstract direction tokens emitted by the BFS in {@link RelationshipInferenceService}.
 * A path is a list of these tokens — e.g. niece-of-me is {@code [SIBLING, DOWN]}.
 *
 * <p>Reversing a path swaps {@link #UP} ↔ {@link #DOWN} and leaves the symmetric
 * tokens ({@link #SPOUSE}, {@link #SIBLING}) untouched.
 */
public enum RelationToken {
    UP,
    DOWN,
    SPOUSE,
    SIBLING;

    public RelationToken reverse() {
        return switch (this) {
            case UP -> DOWN;
            case DOWN -> UP;
            case SPOUSE -> SPOUSE;
            case SIBLING -> SIBLING;
        };
    }
}
