package com.tiedup.remake.entities.ai.maid;

/**
 * Enum representing the behavioral states of an EntityMaid.
 *
 * States control what the maid is currently doing and determine
 * which AI goals are active.
 */
public enum MaidState {
    /**
     * Default state - following trader, ready for orders.
     */
    IDLE,

    /**
     * Delivering a captive to a buyer.
     */
    DELIVERING,

    /**
     * Collecting ransom or items from a job.
     */
    COLLECTING,

    /**
     * Fetching a captive from a cell.
     */
    FETCHING,

    /**
     * Defending the trader from attack.
     */
    DEFENDING,

    /**
     * Patrolling cells proactively to check for escapes and wall damage.
     */
    PATROL,

    /**
     * Extracting a prisoner from their cell for labor.
     */
    EXTRACTING_PRISONER,

    /**
     * Returning a prisoner to their cell after labor completion.
     */
    RETURNING_PRISONER,

    /**
     * Freed state - trader is dead, maid is neutral.
     */
    FREE;

    /**
     * Check if the maid can receive new orders in this state.
     */
    public boolean canReceiveOrders() {
        return this == IDLE;
    }

    /**
     * Check if the maid is actively working on a task.
     */
    public boolean isBusy() {
        return (
            this == DELIVERING ||
            this == COLLECTING ||
            this == FETCHING ||
            this == EXTRACTING_PRISONER ||
            this == RETURNING_PRISONER
        );
    }

    /**
     * Check if the maid should follow the trader.
     */
    public boolean shouldFollowTrader() {
        return this == IDLE || this == DEFENDING;
    }

    /**
     * Check if the maid is in freed state (trader dead).
     */
    public boolean isFreed() {
        return this == FREE;
    }
}
