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

package com.hypixel.hytale.server.worldgen.loader.context;

import javax.annotation.Nonnull;
import java.nio.file.Path;

public class BiomeFileContext extends FileContext<ZoneFileContext>
{
    private final Type type;
    
    public BiomeFileContext(final int id, final String name, final Path filepath, final Type type, final ZoneFileContext parent) {
        super(id, name, filepath, parent);
        this.type = type;
    }
    
    public Type getType() {
        return this.type;
    }
    
    @Nonnull
    public static Type getBiomeType(@Nonnull final Path path) {
        final String name = path.getFileName().toString();
        for (final Type type : Type.values()) {
            if (name.startsWith(type.prefix) && name.endsWith(type.suffix)) {
                return type;
            }
        }
        throw new Error("Unable to determine biome Type from file: " + String.valueOf(path));
    }
    
    public enum Type
    {
        Tile("Tile.", "Tile Biome"), 
        Custom("Custom.", "Custom Biome");
        
        private final String prefix;
        private final String suffix;
        private final String displayName;
        
        private Type(final String prefix, final String displayName) {
            this(prefix, ".json", displayName);
        }
        
        private Type(final String prefix, final String suffix, final String displayName) {
            this.prefix = prefix;
            this.suffix = suffix;
            this.displayName = displayName;
        }
        
        public String getPrefix() {
            return this.prefix;
        }
        
        public String getSuffix() {
            return this.suffix;
        }
        
        public String getDisplayName() {
            return this.displayName;
        }
    }
}
