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

export interface DialogData {
  code: string;
}

@Component({
  selector: 'app-two-factor-dialog',
  templateUrl: './two-factor-dialog.component.html',
  styleUrls: ['./two-factor-dialog.component.scss']
})
export class TwoFactorDialogComponent extends NanoDialogBase<TwoFactorDialogComponent> implements OnInit {

  public data: DialogData = {
    code: ""
  };

  constructor(
    public dialogRef: MatDialogRef<TwoFactorDialogComponent, DialogData>) {
      super(dialogRef);
    }


  ngOnInit(): void {
  }

  onSubmit(){
    if (this.data.code.length > 0){
      this.dialogRef.close(this.data);
    }
  }

  onCancel(){
    this.dialogRef.close({ code: undefined });
  }

}
