/**
 * Read-only database for area data
 * Retrieves area data from a static data structure
 */
export class AreaData {
    areasData = new Map();
    constructor() {
        this.initializeData();
    }
    /**
     * Initialize the data storage with predefined areas
     */
    initializeData() {
        // Load all area data from the predefined dataset
        for (const area of AREAS_DATABASE) {
            this.areasData.set(area.areaId, area);
        }
        console.log(`Initialized AreaData with ${this.areasData.size} areas`);
    }
    /**
     * Get area data by ID
     */
    get(areaId) {
        return this.areasData.get(areaId) || null;
    }
    /**
     * Check if area data exists
     */
    exists(areaId) {
        return this.areasData.has(areaId);
    }
    /**
     * Get all area IDs that have data
     */
    getAllAreas() {
        return Array.from(this.areasData.keys());
    }
    /**
     * Get all areas with their data (for UI display)
     */
    getAllAreasWithData() {
        const areas = [];
        for (const area of this.areasData.values()) {
            if (area && area.data && area.data.isActive) {
                areas.push(area);
            }
        }
        return areas;
    }
    /**
     * Check if a position is within area bounds
     */
    isPositionInArea(pos, startPos, endPos) {
        const minX = Math.min(startPos.x, endPos.x);
        const maxX = Math.max(startPos.x, endPos.x);
        const minY = Math.min(startPos.y, endPos.y);
        const maxY = Math.max(startPos.y, endPos.y);
        const minZ = Math.min(startPos.z, endPos.z);
        const maxZ = Math.max(startPos.z, endPos.z);
        return pos.x >= minX && pos.x <= maxX &&
            pos.y >= minY && pos.y <= maxY &&
            pos.z >= minZ && pos.z <= maxZ;
    }
    /**
     * Get area by position (check which area a position belongs to)
     */
    getAreaByPosition(pos) {
        for (const area of this.areasData.values()) {
            if (area && area.data && area.data.isActive) {
                if (this.isPositionInArea(pos, area.data.coordinates.startPos, area.data.coordinates.endPos)) {
                    return area;
                }
            }
        }
        return null;
    }
}
/**
 * Static database of all area data
 */
const AREAS_DATABASE = [];
