#ifndef ABILITY_H
#define ABILITY_H

#include "AbilityInfo.h"
#include "ISXMr.h"
#include "LSObject.h"


class Ability {
public:
    explicit Ability(const shared_ptr<LSObject> &obj) : lsObject(obj) {
    }

    u_long Id() const;

    bool IsReady() const;

    float TimeUntilReady() const;

    bool IsQueued() const;

    // ABility Details
    bool IsAbilityInfoAvailable() const;

    /// \brief If the ability "details" are not already stored in a cache, then this will return NULL until it is available.
    /// Script writers are encouraged to utilize the logic shown in the sample included with the Knowledgebase article
    /// "Iterating Abilities and Handling 'abilityinfo' Aquisition". http://forge.isxgames.com/projects/isxeq2/knowledgebase/articles/43
    ///
    /// Due to how ISXEQ2 handles the acquisition of abilityinfo, script writers should check IsAbilityInfoAvailable
    /// until it's TRUE before using ToAbilityInfo (as opposed to checking ToAbilityInfo until it's not NULL.)    This methodology will avoid spamming the server with requests.
    AbilityInfo GetAbilityInfo() const;

    ExportedAbility ToExportedAbility() const;


    // Methods
    void Use() const;

    void Examine() const;

private:
    const shared_ptr<LSObject> lsObject;

    static bool RequiresStealth(const vector<string> &effects);

    static bool RequiresFlanking(const vector<string> &effects);

    static bool RequiresNonEpic(const vector<string> &effects);

    static bool IsInterrupt(const vector<string> &effects);

    static bool IsStun(const vector<string> &effects);
};


#endif //ABILITY_H
