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

@Component({
  selector: 'app-outbound-link-dialog',
  templateUrl: './outbound-link-dialog.component.html',
  styleUrls: ['./outbound-link-dialog.component.scss'],
})
export class OutboundLinkDialogComponent extends NanoDialogBaseComponent<OutboundLinkDialogComponent> {
  public linkHref: string;
  public linkDomain: string;

  constructor(
    public dialogRef: MatDialogRef<OutboundLinkDialogComponent>,
    @Inject(MAT_DIALOG_DATA) public location: any
  ) {
    super(dialogRef);

    this.linkHref = location.href;
    this.linkDomain = location.host;
  }

  navigationAccepted(accepted: boolean): void {
    this.dialogRef.close(accepted);
  }
}
