package net.minecraft.server.packs.resources;

import com.google.common.collect.ImmutableList;
import java.io.FileNotFoundException;
import com.google.common.collect.ImmutableSet;
import net.minecraft.server.packs.PackResources;
import java.util.stream.Stream;
import java.util.Collection;
import java.util.function.Predicate;
import java.util.List;
import java.io.IOException;
import net.minecraft.resources.ResourceLocation;
import java.util.Set;

public interface ResourceManager {
    Set<String> getNamespaces();
    
    Resource getResource(final ResourceLocation uh) throws IOException;
    
    boolean hasResource(final ResourceLocation uh);
    
    List<Resource> getResources(final ResourceLocation uh) throws IOException;
    
    Collection<ResourceLocation> listResources(final ResourceLocation uh, final Predicate<String> predicate);
    
    Collection<ResourceLocation> listResources(final String string, final Predicate<String> predicate);
    
    Stream<PackResources> listPacks();
    
    public enum Empty implements ResourceManager {
        INSTANCE;
        
        @Override
        public Set<String> getNamespaces() {
            return ImmutableSet.of();
        }
        
        @Override
        public Resource getResource(final ResourceLocation uh) throws IOException {
            throw new FileNotFoundException(uh.toString());
        }
        
        @Override
        public boolean hasResource(final ResourceLocation uh) {
            return false;
        }
        
        @Override
        public List<Resource> getResources(final ResourceLocation uh) {
            return ImmutableList.of();
        }
        
        @Override
        public Collection<ResourceLocation> listResources(final ResourceLocation uh, final Predicate<String> predicate) {
            return ImmutableSet.of();
        }
        
        @Override
        public Collection<ResourceLocation> listResources(final String string, final Predicate<String> predicate) {
            return ImmutableSet.of();
        }
        
        @Override
        public Stream<PackResources> listPacks() {
            return Stream.<PackResources>of(new PackResources[0]);
        }
    }
}
