// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.server.spawning.suppression.component;

import java.util.Collection;
import javax.annotation.Nonnull;
import com.hypixel.hytale.server.spawning.SpawningPlugin;
import com.hypixel.hytale.component.ResourceType;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import com.hypixel.hytale.component.Ref;
import java.util.Map;
import java.util.List;
import com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
import com.hypixel.hytale.component.Resource;

public class ChunkSuppressionQueue implements Resource<ChunkStore>
{
    private final List<Map.Entry<Ref<ChunkStore>, ChunkSuppressionEntry>> toAdd;
    private final List<Ref<ChunkStore>> toRemove;
    
    public ChunkSuppressionQueue() {
        this.toAdd = new ObjectArrayList<Map.Entry<Ref<ChunkStore>, ChunkSuppressionEntry>>();
        this.toRemove = new ObjectArrayList<Ref<ChunkStore>>();
    }
    
    public static ResourceType<ChunkStore, ChunkSuppressionQueue> getResourceType() {
        return SpawningPlugin.get().getChunkSuppressionQueueResourceType();
    }
    
    @Nonnull
    public List<Map.Entry<Ref<ChunkStore>, ChunkSuppressionEntry>> getToAdd() {
        return this.toAdd;
    }
    
    @Nonnull
    public List<Ref<ChunkStore>> getToRemove() {
        return this.toRemove;
    }
    
    public void queueForAdd(@Nonnull final Ref<ChunkStore> reference, @Nonnull final ChunkSuppressionEntry entry) {
        this.toAdd.add(Map.entry(reference, entry));
    }
    
    public void queueForRemove(final Ref<ChunkStore> reference) {
        this.toRemove.add(reference);
    }
    
    @Nonnull
    @Override
    public Resource<ChunkStore> clone() {
        final ChunkSuppressionQueue queue = new ChunkSuppressionQueue();
        queue.toAdd.addAll(this.toAdd);
        queue.toRemove.addAll(this.toRemove);
        return queue;
    }
}
