package com.tiedup.remake.compat.mca.ai;

/**
 * Defines levels of AI control for MCA villagers during bondage.
 *
 * The AI system progressively restricts villager behavior based on
 * their bondage state, from normal behavior to complete immobilization.
 */
public enum MCABondageAILevel {
    /**
     * NONE: Normal MCA behavior, no TiedUp interference.
     * Used when: Not tied, no collar
     */
    NONE,

    /**
     * BASIC: Minimal restrictions.
     * Effects:
     * - Reduced movement speed (via attribute modifier)
     * - Navigation stopped when first applied
     * Used when: Collar only (not tied)
     */
    BASIC,

    /**
     * MODIFIED: Custom goals injected alongside MCA goals.
     * Effects:
     * - All BASIC effects
     * - FollowCaptorGoal when leashed
     * - PanicGoal when being restrained
     * - FleeGoal when not collared
     * Used when: Tied up (arms or legs bound)
     */
    MODIFIED,

    /**
     * OVERRIDE: Complete AI replacement.
     * Effects:
     * - All MODIFIED effects
     * - MCA brain activities suspended
     * - Only TiedUp goals active (StayGoal)
     * Used when: Fully tied (arms AND legs) OR gagged AND blindfolded
     */
    OVERRIDE;

    /**
     * Check if this level has speed reduction applied.
     */
    public boolean hasSpeedReduction() {
        return this != NONE;
    }

    /**
     * Check if this level injects custom goals.
     */
    public boolean hasCustomGoals() {
        return this == MODIFIED || this == OVERRIDE;
    }

    /**
     * Check if this level suspends MCA's brain.
     */
    public boolean suspendsMCABrain() {
        return this == OVERRIDE;
    }

    /**
     * Get the next level up (more restrictive).
     */
    public MCABondageAILevel nextLevel() {
        return switch (this) {
            case NONE -> BASIC;
            case BASIC -> MODIFIED;
            case MODIFIED -> OVERRIDE;
            case OVERRIDE -> OVERRIDE;
        };
    }

    /**
     * Get the previous level (less restrictive).
     */
    public MCABondageAILevel previousLevel() {
        return switch (this) {
            case NONE -> NONE;
            case BASIC -> NONE;
            case MODIFIED -> BASIC;
            case OVERRIDE -> MODIFIED;
        };
    }
}
