import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
import org.openqa.selenium.support.PageFactory;

public class AccountSettingsPage {
  WebDriver driver;

  @FindBy(how = How.ID, using = "input-firstName")
  WebElement firstNameInput;

  @FindBy(how = How.ID, using = "input-lastName")
  WebElement lastNameInput;

  @FindBy(how = How.ID, using = "emailIdaccount")
  WebElement emailInput;


  public AccountSettingsPage(WebDriver driver) {
    this.driver = driver;
    PageFactory.initElements(driver, this);
  }

  public void confirmLogin(String firstName, String lastName, String email) {
    assertAll("First name, last name, and email should match account props",
            () -> assertEquals(firstName, firstNameInput.getAttribute("value")),
            () -> assertEquals(lastName, lastNameInput.getAttribute("value")),
            () -> assertEquals(email, emailInput.getAttribute("value"))
//            () -> assertEquals(email, firstName) // should fail
    );
  }

}
