import { Component, HostListener, OnInit } from '@angular/core';
import { MatDialogRef } from '@angular/material';
import { BytebotSettingsService } from 'projects/bytebot-html/src/app/services/bytebot-settings-service';
import { first } from 'rxjs/operators';

@Component({
  selector: 'byte-cron-expression-dialog',
  templateUrl: './cron-expression-dialog.component.html',
  styleUrls: ['./cron-expression-dialog.component.scss']
})
export class CronExpressionDialogComponent implements OnInit {
  // logo: any;
  // logoTipo: any;
  // logoBase64: any;
  // logoSrc: any;

  constructor(
    private bytebotSettingsService: BytebotSettingsService,
    public dialogRef: MatDialogRef<CronExpressionDialogComponent>
  ) {
    // this.bytebotSettingsService.getApplicationSettings().pipe(first()).subscribe(result => {
    //   this.logo = result;
    //   this.logoTipo = this.logo.tipo;
    //   this.logoBase64 = this.logo.logoBase64;
    //   this.logoSrc = 'data:image/'.concat(this.logoTipo, ';base64,', this.logoBase64);
    // });
  }

  ngOnInit() { }

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

  @HostListener('window:keyup.esc') onKeyUp() {
    this.dialogRef.close({ success: false });
  }
}
