#nullable enable
using System.Collections.Generic;

namespace AdvChkSys.Interfaces
{
    /// <summary>
    /// Interface for managing chunks in memory.
    /// Provides methods for loading, unloading, and accessing chunks.
    /// </summary>
    public interface IChunkManager
    {
        /// <summary>
        /// Returns true if the chunk at (x, y) is loaded.
        /// </summary>
        bool IsChunkLoaded(int x, int y);

        /// <summary>
        /// Gets the chunk at (x, y) if loaded, or null if not.
        /// </summary>
        IChunk? GetChunk(int x, int y);

        /// <summary>
        /// Loads or creates a chunk at (x, y) with the given size.
        /// Returns the loaded or newly created chunk.
        /// </summary>
        IChunk LoadOrCreateChunk(int x, int y, int width, int height);

        /// <summary>
        /// Unloads (removes) the chunk at (x, y) if loaded.
        /// </summary>
        bool UnloadChunk(int x, int y);

        /// <summary>
        /// Enumerates all loaded chunks.
        /// </summary>
        IEnumerable<IChunk> GetAllChunks();
    }
}