import { Component, Input } from '@angular/core';
import { ResourcesService } from '../../../services/resources.service';
import { Router } from '@angular/router';

@Component({
    selector: 'app-btn-navigate',
    templateUrl: './btn-navigate.component.html',
    styleUrl: './btn-navigate.component.css',
    standalone: false
})
export class BtnNavigateComponent {
  @Input() public nameButton: string;
  @Input() public widthPosition: string;
  @Input() public navigate: string;
  @Input() public changeLanguage: boolean;
  
  constructor(
    public resourcesService: ResourcesService,
    private _router: Router,
  ) {
    this.nameButton = 'Regresar';
    this.widthPosition = '0%';
    this.navigate = 'goback';
    this.changeLanguage = false;
  }

  public navigateRoute() {
    if (this.navigate === 'goback') {
      this.resourcesService.goBack();
    } else {
      this._router.navigate([this.navigate]);
    }
  }
}
