import { Component, Inject, OnInit } from "@angular/core";
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog";
import { TranslateService } from "@ngx-translate/core";
import { NanoDialogBase } from "../nano-base-dialog";

@Component({
  selector: "app-general-input-dialog",
  templateUrl: "./general-input-dialog.component.html",
  styleUrls: ["./general-input-dialog.component.scss"],
})
export class GeneralInputDialogComponent extends NanoDialogBase<GeneralInputDialogComponent> implements OnInit {
  public inputValue: string;

  constructor(
    public dialogRef: MatDialogRef<GeneralInputDialogComponent>,
    @Inject(MAT_DIALOG_DATA) public generalInputData: GeneralInputDialogData,
    public translate: TranslateService
  ) {
    super(dialogRef);
    this.inputValue = this.generalInputData.input;
  }

  ngOnInit(): void {}

  submit() {
    this.dialogRef.close(this.inputValue);
  }
}

export interface GeneralInputDialogData {
  title: string;
  text: string;
  input: string;
  canBeEmpty: boolean;
}
