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

@Component({
  selector: 'app-btn-navigate',
  templateUrl: './btn-navigate.component.html',
  styleUrls: ['./btn-navigate.component.css']
})
export class BtnNavigateComponent {

  @Input() public nameButton: string;
  @Input() public widthPosition: string;
  @Input() public navigate: string;
  constructor(
    public resourcesService: ResourcesService,
    private _router: Router,
  ) {
    this.nameButton = 'Regresar';
    this.widthPosition = '12.4%';
    this.navigate = 'goback';
  }

  public navigateRoute() {
    if (this.navigate === 'goback') {
      this.resourcesService.goBack();

    } else {
      this._router.navigate([this.navigate]);

    }
  }

}
