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 { AppRef, {{#if enableSpa}}BaseSpaPageComponent{{else}}BasePageComponent{{/if}} } from '@wm/runtime/base';

@Component({
    selector: 'app-page-{{name}}',
    templateUrl: './{{name}}.component.html',
    styleUrls: ['./{{name}}.component.css'],
    encapsulation: ViewEncapsulation.None,
    providers: [
        {
            provide: UserDefinedExecutionContext,
            useExisting: {{componentName}}
        }
    ]
})
export class {{componentName}} extends {{#if enableSpa}}BaseSpaPageComponent{{else}}BasePageComponent{{/if}} {

    override pageName = '{{name}}';
    [key: string]: any;

    constructor() {
        super();
        super.init();
    }

    getVariables() {
        return getVariables();
    }

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

    getExpressions() {
        return expressionData;
    }

}
