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 { BasePartialComponent } from '@wm/runtime/base';

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

    partialName = '{{name}}';
    [key: string]: any;
    {{#if enableSpa}}spa = true;{{/if}}

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

    getVariables() {
        return getVariables();
    }

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

    getExpressions() {
        return expressionData;
    }

}
