/**
 * Filename: index.ts
 * Author: Stevan Bosanac
 * Created Date: 2024-09-17
 *
 * Description:
 * The `BackPanelPlugIns` class contains an array of control classes and a method to retrieve aspecific control by name.
 *
 * Revision History:
 * 2024-09-17: Initial creation
 *
 */

import { AudioControls } from './AudioControls';
import { AudioSpritesControls } from './AudioSpritesControls';
import { LanguageControls } from './LanguageControls';
import { UserControls } from './UserControls';

/*
 * The `BackPanelPlugIns` class contains an array of control classes and a method to retrieve aspecific control by name.
 */
export class BackPanelPlugIns
{
    static _controls = [
        UserControls,
        AudioControls,
        AudioSpritesControls,
        LanguageControls,
    ];

    /**
     * The function `getControll` returns a control object from an array based on the provided control
     * name.
     * @param controlName - The `controlName` parameter is the name of the control that you want to
     * retrieve from the `_controls` array. The `getControll` method searches for a control in the
     * `_controls` array based on the provided `controlName` and returns the control object if found.
     * @returns The `getControll` method is returning a control object from the `_controls` array that
     * matches the `controlName` parameter passed to the method.
     */
    static getControll(controlName: string)
    {
        return this._controls.find((control) => control.controlName === controlName);
    }
}
