package com.openosrs.client.api.types;

/**
 * Enumeration of all RuneScape skills that agents can monitor and interact with.
 * These correspond directly to the skills available in Old School RuneScape.
 */
public enum Skill {
    // Combat skills
    ATTACK(0, "Attack"),
    DEFENCE(1, "Defence"), 
    STRENGTH(2, "Strength"),
    HITPOINTS(3, "Hitpoints"),
    RANGED(4, "Ranged"),
    PRAYER(5, "Prayer"),
    MAGIC(6, "Magic"),
    
    // Artisan skills
    COOKING(7, "Cooking"),
    WOODCUTTING(8, "Woodcutting"),
    FLETCHING(9, "Fletching"),
    FISHING(10, "Fishing"),
    FIREMAKING(11, "Firemaking"),
    CRAFTING(12, "Crafting"),
    SMITHING(13, "Smithing"),
    MINING(14, "Mining"),
    HERBLORE(15, "Herblore"),
    AGILITY(16, "Agility"),
    THIEVING(17, "Thieving"),
    
    // Support skills
    SLAYER(18, "Slayer"),
    FARMING(19, "Farming"),
    RUNECRAFT(20, "Runecraft"),
    HUNTER(21, "Hunter"),
    CONSTRUCTION(22, "Construction");
    
    private final int index;
    private final String name;
    
    Skill(int index, String name) {
        this.index = index;
        this.name = name;
    }
    
    /**
     * Get the skill index (used internally by RuneScape).
     */
    public int getIndex() {
        return index;
    }
    
    /**
     * Get the human-readable skill name.
     */
    public String getName() {
        return name;
    }
    
    /**
     * Get skill by index.
     */
    public static Skill fromIndex(int index) {
        for (Skill skill : values()) {
            if (skill.index == index) {
                return skill;
            }
        }
        throw new IllegalArgumentException("Unknown skill index: " + index);
    }
    
    /**
     * Check if this is a combat skill.
     */
    public boolean isCombatSkill() {
        return this == ATTACK || this == DEFENCE || this == STRENGTH || 
               this == HITPOINTS || this == RANGED || this == PRAYER || this == MAGIC;
    }
    
    /**
     * Check if this is an artisan skill.
     */
    public boolean isArtisanSkill() {
        return this == COOKING || this == WOODCUTTING || this == FLETCHING ||
               this == FISHING || this == FIREMAKING || this == CRAFTING ||
               this == SMITHING || this == MINING || this == HERBLORE ||
               this == AGILITY || this == THIEVING;
    }
    
    /**
     * Check if this is a support skill.
     */
    public boolean isSupportSkill() {
        return this == SLAYER || this == FARMING || this == RUNECRAFT ||
               this == HUNTER || this == CONSTRUCTION;
    }
    
    @Override
    public String toString() {
        return name;
    }
}