import { Component, Input, OnInit, OnChanges } from "@angular/core";
import { Router } from "@angular/router";

@Component({
  selector: "inv-proposal-navbar",
  templateUrl: "./navbar-inv-proposals.html",
  styleUrls: ["./navbar-inv-proposals.scss"]
})
export class NavbarInvProposalComponent implements OnInit, OnChanges {
  @Input() activeLink: string;
  @Input() investmentID: string;
  activeRoute: string;
  general_link: string;

  constructor(private router: Router) {}

  ngOnInit() {}
  ngOnChanges() {}
  /**if (this.investmentProposalID != undefined) {
        this.router.navigate([
          "/investment-proposal/instrument-work",
          { id: this.investmentProposalID }
        ]);
      } else {
        this.router.navigate(["/investment-proposal/instrument-work"]);
      } */
  goToStep(step: string) {
    console.log(step);
    switch (step) {
      case "general":
        if (this.investmentID != undefined) {
          this.router.navigate(["/investment-proposal/general-info"], {
            queryParams: { id: this.investmentID }
          });
        } else {
          this.router.navigate(["/investment-proposal/general-info"]);
        }
        break;
      case "instrument":
        if (this.investmentID != undefined) {
          this.router.navigate(["/investment-proposal/instrument-work"], {
            queryParams: { id: this.investmentID }
          });
        } else {
          this.router.navigate(["/investment-proposal/instrument-work"]);
        }

        break;
      case "other_info":
        if (this.investmentID != undefined) {
          this.router.navigate(["/investment-proposal/complement-info"], {
            queryParams: { id: this.investmentID }
          });
        } else {
          this.router.navigate(["/investment-proposal/complement-info"]);
        }
        break;
      case "result":
        if (this.investmentID != undefined) {
          this.router.navigate(["/investment-proposal/result"], {
            queryParams: { id: this.investmentID }
          });
        } else {
          this.router.navigate(["/investment-proposal/result"]);
        }
        break;
      default:
    }
  }
}
