// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import { Enum } from '@rushstack/node-core-library';
/**
 * Events happen during Rush runs.
 * @beta
 */
export var Event;
(function (Event) {
    /**
     * Pre Rush install event
     */
    Event[Event["preRushInstall"] = 1] = "preRushInstall";
    /**
     * Post Rush install event
     */
    Event[Event["postRushInstall"] = 2] = "postRushInstall";
    /**
     * Pre Rush build event
     */
    Event[Event["preRushBuild"] = 3] = "preRushBuild";
    /**
     * Post Rush build event
     */
    Event[Event["postRushBuild"] = 4] = "postRushBuild";
    /**
     * Start of rushx execution event
     */
    Event[Event["preRushx"] = 5] = "preRushx";
    /**
     * End of rushx execution event
     */
    Event[Event["postRushx"] = 6] = "postRushx";
})(Event || (Event = {}));
/**
 * This class represents Rush event hooks configured for this repo.
 * Hooks are customized script actions that Rush executes when specific events occur.
 * The actions are expressed as a command-line that is executed using the operating system shell.
 * @beta
 */
export class EventHooks {
    /**
     * @internal
     */
    constructor(eventHooksJson) {
        this._hooks = new Map();
        for (const [name, eventHooks] of Object.entries(eventHooksJson)) {
            const eventName = Enum.tryGetValueByKey(Event, name);
            if (eventName) {
                this._hooks.set(eventName, [...eventHooks]);
            }
        }
    }
    /**
     * Return all the scripts associated with the specified event.
     * @param event - Rush event
     */
    get(event) {
        return this._hooks.get(event) || [];
    }
}
//# sourceMappingURL=EventHooks.js.map