package com.openosrs.client.api.types;

/**
 * Enumeration of equipment slots available in RuneScape.
 * These correspond to the wearable item slots in the game.
 */
public enum EquipmentSlot {
    HEAD(0, "Head"),
    CAPE(1, "Cape"),
    AMULET(2, "Amulet"),
    WEAPON(3, "Weapon"),
    BODY(4, "Body"),
    SHIELD(5, "Shield"),
    LEGS(7, "Legs"),
    GLOVES(9, "Gloves"),
    BOOTS(10, "Boots"),
    RING(12, "Ring"),
    AMMO(13, "Ammo");
    
    private final int slotId;
    private final String name;
    
    EquipmentSlot(int slotId, String name) {
        this.slotId = slotId;
        this.name = name;
    }
    
    /**
     * Get the slot ID (used internally by RuneScape).
     */
    public int getSlotId() {
        return slotId;
    }
    
    /**
     * Get the human-readable slot name.
     */
    public String getName() {
        return name;
    }
    
    /**
     * Get equipment slot by ID.
     */
    public static EquipmentSlot fromSlotId(int slotId) {
        for (EquipmentSlot slot : values()) {
            if (slot.slotId == slotId) {
                return slot;
            }
        }
        throw new IllegalArgumentException("Unknown equipment slot ID: " + slotId);
    }
    
    /**
     * Check if this is a combat-related equipment slot.
     */
    public boolean isCombatSlot() {
        return this == WEAPON || this == SHIELD || this == AMMO;
    }
    
    /**
     * Check if this is an armor slot.
     */
    public boolean isArmorSlot() {
        return this == HEAD || this == BODY || this == LEGS || this == GLOVES || this == BOOTS;
    }
    
    /**
     * Check if this is an accessory slot.
     */
    public boolean isAccessorySlot() {
        return this == CAPE || this == AMULET || this == RING;
    }
    
    @Override
    public String toString() {
        return name;
    }
}