import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { IconType } from '@msfa-enums/icon-type.enum';

@Component({
  selector: 'msfa-back-link',
  templateUrl: './back-link.component.html',
  styleUrls: ['./back-link.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class BackLinkComponent {
  private readonly _defaultClass = 'back-link';
  @Input() route: string[];
  @Input() showIcon = true;
  @Input() asButton = false;
  iconType = IconType;

  get backLinkClass(): string {
    if (this.asButton) {
      return `${this._defaultClass} ${this._defaultClass}--button`;
    }

    return `${this._defaultClass} ${this._defaultClass}--link`;
  }
}
