import { Component, Input, OnInit } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { AccountInfoService } from 'src/app/services/accountInfo/account-info.service';
import { Router } from '@angular/router';
import { environment } from 'src/environments/environment';

@Component({
  standalone: false,
  selector: 'app-almost-there',
  templateUrl: './almost-there.component.html',
  styleUrls: ['./almost-there.component.scss']
})
export class AlmostThereComponent implements OnInit {
    @Input() almostThereModalClose!: () => void;
    imgUrl: string = environment.imageUrl;
    constructor(
      private router: Router,
      public activeModal: NgbActiveModal,
      private accountInfoService: AccountInfoService
    ) {}
    ngOnInit(): void {
    }
    
    finishMyRegistration(){
        this.accountInfoService.trackRegisterEvent({ event_type: 'registration', event_source: 'almost_there_modal' })
            .subscribe({
                next: (res: any) => {
                },
                error: (err) => {
                    this.accountInfoService.errorCallBack(err);
                },
                complete: () => { },
        });
        this.activeModal.close('ok');
        this.router.navigate(['/market/registration']);
    }
}
