import { Component, OnInit } from '@angular/core';
import { ModalDialogParams } from '@nativescript/angular';

@Component({
    moduleId: module.id,
    templateUrl: './modal-view-warning.component.html',
    styleUrls: ['./_modal-view-warning.component.scss']
})
export class ModalWarningComponent implements OnInit {

    label: string;
    message: string;
    content: string[];
    height: string = '30%';

    constructor(private _params: ModalDialogParams
    ) { }

    ngOnInit(): void {
        if (this._params.context.label) {
            this.label = this._params.context.label;
        }
        if (this._params.context.message) {
            this.message = this._params.context.message;
        }
        if (this._params.context.content) {
            this.content = this._params.context.content;
        }
        if (this._params.context.height) {
            this.height = this._params.context.height;
        }
    }

    templateSelector(item: any, index: number, items: any): string {
        return 'default';
    }

    onClose(): void {
        this._params.closeCallback(null);
    }

    get helpIcon() {
        return String.fromCharCode(0xf06a);
    }
}
