import { Component, Injector, ViewEncapsulation } from '@angular/core';

import { UserDefinedExecutionContext } from '@wm/core';

import { initScript } from './{{name}}.component.script';
import { getVariables } from './{{name}}.component.variables';
import { expressionData } from './{{name}}.component.expressions';

import { BasePrefabComponent } from '@wm/runtime/base';

@Component({
    selector: 'app-prefab-{{prefabName}}',
    templateUrl: './{{name}}.component.html',
    styleUrls: ['./{{name}}.component.css'],
    encapsulation: ViewEncapsulation.None,
    providers: [
        {
            provide: UserDefinedExecutionContext,
            useExisting: {{componentName}}
        }
    ]
})
export class {{componentName}} extends BasePrefabComponent {

    prefabName = '{{prefabName}}';
    [key: string]: any;

    constructor(public injector: Injector) {
        super();
        super.init();
    }

    getVariables() {
        return getVariables();
    }

    evalUserScript(Prefab, App, Utils) {
        initScript(Prefab, App, Utils);
    }

    getExpressions() {
        return expressionData;
    }

}
