package de.winniepat.citrus.cosmetics.halo;

import net.minecraft.util.Identifier;

public enum HaloType {
    NONE("none", null, null, null, 1.0f, 0.0, 0.0, 0.0),
    ANGEL_HALO("angel_halo", "angel_halo", "angel_halo.png", "angel_halo", 10f, 0.0, 1.2, 0.1);

    private final String id;
    private final String modelName;
    private final String textureName;
    private final String animationName;
    private final float scale;
    private final double posX, posY, posZ;

    HaloType(String id, String modelName, String textureName, String animationName,
             float scale, double posX, double posY, double posZ) {
        this.id = id;
        this.modelName = modelName;
        this.textureName = textureName;
        this.animationName = animationName;
        this.scale = scale;
        this.posX = posX;
        this.posY = posY;
        this.posZ = posZ;
    }

    public String getId() {
        return id;
    }

    public String getModelName() {
        return modelName;
    }

    public Identifier getModelId() {
        if (modelName == null || NONE.id.equals(id)) return null;
        return Identifier.of("citrus", "geo/halo/" + modelName + ".geo.json");
    }

    public Identifier getTextureId() {
        if (textureName == null || NONE.id.equals(id)) return null;
        return Identifier.of("citrus", "textures/cosmetics/halo/" + textureName);
    }

    public Identifier getAnimationResource() {
        if (animationName == null || NONE.id.equals(id)) return null;
        return Identifier.of("citrus", "animations/halo/" + animationName + ".animation.json");
    }

    public float getScale() {
        return scale;
    }

    public double getPosX() {
        return posX;
    }

    public double getPosY() {
        return posY;
    }

    public double getPosZ() {
        return posZ;
    }

    public static HaloType fromId(String id) {
        if (id == null || id.equals("none") || id.isEmpty()) return NONE;

        for (HaloType type : values()) {
            if (type.id.equalsIgnoreCase(id)) {
                return type;
            }
        }
        return NONE;
    }

    public static HaloType[] getAvailableTypes() {
        return values();
    }
}