import {IFactory} from '../interfaces/commands/IFactory';
import {IAppCommands} from '../interfaces/commands/IAppCommands';
import {AppCommands} from './AppCommands';
import {Helpers} from '@common/admin/Helpers';

export class Factory implements IFactory {

    protected conf:any;

    protected appCommands:IAppCommands = null;

    public init(conf:any = {}): void
    {
        this.conf = {
            'commands': null
        };
        Helpers.objectReplaceRecursive(this.conf, conf);
    }

    public getAppCommands():IAppCommands
    {
        if(this.appCommands === null){
            this.appCommands = this.conf.commands || new AppCommands();
        }
        return this.appCommands;
    }

}