import { Component, OnInit } from '@angular/core';
import { FormBuilder, Validators } from '@angular/forms';

@Component({
  selector: 'app-contact-us',
  templateUrl: './contact-us.component.html',
  styleUrls: ['./contact-us.component.css']
})
export class ContactUsComponent implements OnInit {
  public contactForm;
  public showMessage: boolean = false;
  public invalidEntry = "Invalid Entry";

  constructor(private formBuilder: FormBuilder) { }

  ngOnInit() {
    this.contactForm = this.formBuilder.group({
      firstName: ['', [Validators.required ]],
      lastName: ['',[ Validators.required ]],
      email: ['', [ Validators.required ]],
    });
  }

  onSubmit(){
    if (this.contactForm.valid) {
      alert("You message was successfully sent!")
    } else {
      alert("Big no, pls fix")
    }
  }

  get firstName() { return this.contactForm.firstName }
  get lastName() { return this.lastName }
  get email() { return this.email }
}
