import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { USER } from '@core/models/authenticcation.model';
import { select, Store } from '@ngrx/store';
import { Observable } from 'rxjs';

@Component({
  selector: 'app-landing-header',
  templateUrl: './landing-header.component.html',
  styleUrls: ['./landing-header.component.scss'],
})
export class LandingHeaderComponent {
  user$!: Observable<USER>;

  constructor(
    private readonly router: Router,
    private readonly store: Store<{ user: { profile: USER } }>
  ) {
    this.user$ = this.store.pipe(select((state) => state.user.profile));
  }

  onSignIn(): void {
    this.router.navigate(['auth']);
  }

  onSignUp(): void {
    this.router.navigate(['auth/signUp']);
  }
}
