import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatDividerModule } from '@angular/material/divider';
import { AngularMaterialModule } from '../../angular-material/angular-material.module';
import { AuthService } from '../../auth/authService/auth.service';

@Component({
  selector: 'app-verify-email-warn-card',
  standalone: true,
  imports: [CommonModule, AngularMaterialModule, MatDividerModule],
  templateUrl: './verify-email-warn-card.component.html',
  styleUrl: './verify-email-warn-card.component.css',
})
export class VerifiyWarnCardComponent {
  hideCard = false;

  constructor(private authService: AuthService) {}

  ngOnInit() {
    this.hideCard = this.isUserVerified();
  }

  resendVerificationEmail() {
    this.authService.sendVerificationEmail();
  }

  isUserVerified() {
    return !!this.authService.getCurrentUser()?.emailVerified;
  }
}
