/**
 * @abstract
 * @class Hook
 * @description Base class for all hooks, providing a unified interface with `update(dt)` and `isComplete()` methods.
 * Derived classes must implement these methods to define hook behavior.
 */
abstract class Hook
{
    /**
     * Updates the state of the hook. This method should be implemented in derived classes.
     * @abstract
     * @param {number} dt - Delta time in milliseconds since the last update.
     * @throws {Error} Throws an error if not implemented in the subclass.
     */
    abstract update(dt: number): void;

    /**
     * Checks if the hook has completed its task. This method should be implemented in derived classes.
     * @abstract
     * @returns {boolean} `true` if the hook is complete, otherwise `false`.
     * @throws {Error} Throws an error if not implemented in the subclass.
     */
    abstract isComplete(): boolean;

    /**
     * Callback function that gets executed when an operation is completed.
     * @returns {void}
     */
    onComplete: () => void;

    /**
     * Sets the callback function to be executed upon completion.
     * @param callback - The function to be called when the operation is complete.
     * @returns {void}
     */
    setOnComplete(callback: () => void): void
    {
        this.onComplete = callback;
    }
}

export default Hook;
