package de.winniepat.citrus.cosmetics.wings;

import net.minecraft.util.Identifier;

public enum WingType {
    /*
    Weil ich Alzheimer hab: ~Winnie

    posX: Größer = weiter links
    posY: Größer = höher
    posZ: Größer = weiter vorn
     */

    NONE("none", null, null, null, 1f, 0, 0, 0),

    TEST1("wings", "wings", "wings.png", "wings",
            1f,
            0.2,
            0.9,
            0
    ),

    TEST2("wings2", "wings2", "wings2.png", "wings2",
            1.8f,
            -0.2,
            -0.4,
            -0.1
    ),

    TEST3("wings3", "angel_wings", "angel_wings.png", "angel_wings",
            1.8f,
            -0.2,
            -0.4,
            -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;

    WingType(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) return null;
        return Identifier.of("citrus", "geo/" + modelName + ".geo.json");
    }

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

    public Identifier getAnimationResource() {
        if (animationName == null || NONE.id.equals(id)) return null;
        return Identifier.of("citrus", "animations/" + 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 WingType fromId(String id) {
        if (id == null || id.equals("none") || id.isEmpty()) {
            return NONE;
        }

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

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