import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { Params } from '@angular/router';
import { UiLinkButtonType } from './link-button-type.enum';

@Component({
  selector: 'ui-link-button',
  templateUrl: './link-button.component.html',
  styleUrls: ['./link-button.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class LinkButtonComponent {
  private readonly _defaultClass = 'ui-link-button';
  @Input() uiType: UiLinkButtonType = UiLinkButtonType.PRIMARY;
  @Input() uiSize: 's' | 'm' = 'm';
  @Input() uiRouterLink: string | string[];
  @Input() uiQueryParams: Params = null;

  get linkButtonClass(): string {
    if (this.uiType) {
      return `${this._defaultClass} ${this._defaultClass}--${this.uiType as string}`;
    }
    return this._defaultClass;
  }
}
