import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
import { Inject, Component, ViewChild, OnInit } from "@angular/core";
import { I18nService } from "../../services/internationalisation/internationalisation.service";
import { NgParameter } from "../../formulaire/ngparam";
import { NgParamInputComponent } from "../ngparam-input/ngparam-input.component";

@Component({
    selector: "dialog-edit-param-computed",
    templateUrl: "dialog-edit-param-computed.component.html",
    styleUrls: ["dialog-edit-param-computed.component.scss"]
})
export class DialogEditParamComputedComponent implements OnInit {

    /** the related parameter to change the "fixed" value of */
    public param: NgParameter;

    @ViewChild(NgParamInputComponent)
    private _ngParamInputComponent: NgParamInputComponent;

    constructor(
      public dialogRef: MatDialogRef<DialogEditParamComputedComponent>,
      private intlService: I18nService,
      @Inject(MAT_DIALOG_DATA) public data: any
    ) {
      this.param = data.param;
    }

    public get uitextClose() {
      return this.intlService.localizeText("INFO_OPTION_CLOSE");
    }

    public get uitextEditParamComputedInitialValue() {
      return "Modifier la valeur initiale (à traduire)";
      // return this.intlService.localizeText("INFO_OPTION_ALL");
    }

    public ngOnInit() {
      this._ngParamInputComponent.model = this.param;
    }
}