// Angular Core
import { Component, OnInit, Input , SimpleChanges} from '@angular/core';

@Component({
  standalone: false,
  selector: 'app-registration-status-header',
  templateUrl: './registration-status-header.component.html',
  styleUrls: ['./registration-status-header.component.scss']
})
export class RegistrationStatusHeaderComponent implements OnInit {

  @Input() active:string = 'step1';
  @Input() buyer:boolean = true;
  step1: string = '';
  step2: string = '';
  step3: string = '';
  step4: string = '';
  step5: string = '';
  step6: string = '';

  constructor() { }

  ngOnInit(): void {
    this.setActiveTab();
  }

  ngOnChanges(changes: SimpleChanges) {
    this.setActiveTab();
  }

  setActiveTab(){

    switch (this.active) {
      case 'step1':
        this.step1 = 'rsh-active';
        this.step2 = '';
        this.step3 = '';
        this.step4 = '';
        this.step5 = '';
        this.step6 = '';
        break;
      case 'step2':
        this.step1 = 'rsh-complete';
        this.step2 = 'rsh-active';
        this.step3 = '';
        this.step4 = '';
        this.step5 = '';
        this.step6 = '';
        break;
      case 'step3':
        this.step1 = 'rsh-complete';
        this.step2 = 'rsh-complete';
        this.step3 = 'rsh-active';
        this.step4 = '';
        this.step5 = '';
        this.step6 = '';
        break;
      case 'step4':
        this.step1 = 'rsh-complete';
        this.step2 = 'rsh-complete';
        this.step3 = 'rsh-complete';
        this.step4 = 'rsh-active';
        this.step5 = '';
        this.step6 = '';
        break;
      case 'step5':
        this.step1 = 'rsh-complete';
        this.step2 = 'rsh-complete';
        this.step3 = 'rsh-complete';
        this.step4 = 'rsh-complete';
        this.step5 = 'rsh-active';
        this.step6 = '';
        break;
      case 'step6':
        this.step1 = 'rsh-complete';
        this.step2 = 'rsh-complete';
        this.step3 = 'rsh-complete';
        this.step4 = 'rsh-complete';
        this.step5 = 'rsh-complete';
        this.step6 = 'rsh-active';
        break;
    }

  }

}