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

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

import { initScript } from './{{name}}.component.script';
import { getVariables } from './{{name}}.component.variables';
import { AppRef, BaseCustomWidgetComponent } from '@wm/runtime/base';
import { RuntimeBaseModule } from '@wm/runtime/base';
{{WMComponentsImportStmts requiredWMComponents}}

@Component({
    standalone: true,
    selector: 'app-custom-{{name}}',
    templateUrl: './{{name}}.component.html',
    styleUrls: ['./{{name}}.component.css'],
    encapsulation: ViewEncapsulation.None,
    imports: [ RuntimeBaseModule, {{WMComponentModuleStmts requiredWMComponents}}],
    providers: [
        {
            provide: UserDefinedExecutionContext,
            useExisting: {{componentName}}
        }
    ]
})
export class {{componentName}} extends BaseCustomWidgetComponent {

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

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

    getVariables() {
        return getVariables();
    }

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