import { Router } from '@angular/router';
import { Component, inject, OnInit } from '@angular/core';
import { FormGroup, FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';

import { BreadcrumbService } from '../breadcrumb.service';
import { AuthenticationService } from '../../providers/user/authentication.service';

@Component({
  standalone: true,
  selector: 'about-us',
  templateUrl: './aboutus.component.html',
  imports: [FormsModule, ReactiveFormsModule]
})
export class AboutUsComponent implements OnInit
{
  public aboutUsForm: FormGroup;

  private readonly router = inject(Router);
  private readonly formBuilder = inject(FormBuilder);
  private readonly bcService = inject(BreadcrumbService);
  private readonly authService = inject(AuthenticationService);

  constructor()
  {
    if (!this.authService.currentUserValue)
    {
      this.router.navigate(['/login']);
      return;
    }

    this.bcService.setItems([{ label: 'Contact us', routerLink: ['/aboutus'] }]);
  }

  ngOnInit(): void
  {
    this.aboutUsForm = this.formBuilder.group(
      {
        fld1: '',
        fld2: '',
        fld3: '',
        fld4: '',
        fld5: '',
        fld6: ''
      }
    );
  }
}
