package com.livingworld.regions;

/**
 * Lifecycle states for a region in the Living World simulation.
 *
 * <p>This enum tracks the state transitions of a region as it is loaded,
 * simulated, saved, and unloaded during gameplay.</p>
 */
public enum RegionLifecycleState {

    /**
     * The region is not currently loaded in memory.
     * No data is held; the region exists only on disk (or has never been created).
     */
    UNLOADED,

    /**
     * The region is being read from disk and initialized.
     * Data structures are being constructed but the region is not yet ready for simulation.
     */
    LOADING,

    /**
     * The region is fully loaded and actively processing simulation ticks.
     * Entities, blocks, and other systems within this region are updated each cycle.
     */
    ACTIVE,

    /**
     * The region has been modified since it was last saved.
     * These changes must be persisted to disk before the region can be safely unloaded.
     */
    DIRTY,

    /**
     * The region's data is being written to disk.
     * No modifications should occur while in this state.
     */
    SAVING,

    /**
     * An error occurred during loading, saving, or simulation.
     * The region cannot continue normal operations and requires manual intervention or reset.
     */
    FAILED,

    /**
     * The region is being removed from memory after simulation.
     * Data is being flushed to disk (if dirty) and internal structures are being released.
     */
    UNLOADING;
}