import {Component, inject, OnInit} from '@angular/core';
import {Router} from '@angular/router';
import {FullSizeComponent} from '@shared-components/full-size/full-size.component';
import {HeaderComponent} from '@header/header.component';

@Component({
  selector: 'app-sent',
  imports: [
    HeaderComponent,
    FullSizeComponent
  ],
  templateUrl: './sent.component.html',
  styleUrl: './sent.component.scss',
  standalone: true
})
export class SentComponent implements OnInit {
  protected message: string = "The form is completed and has been sent";
  private router: Router = inject(Router)

  ngOnInit() {
    const state = this.router.getCurrentNavigation()?.extras.state || history.state;

    if (state && 'message' in state) {
      this.message = state.message as string;
    }
  }

}
