module Workstation
  class CreateNewUserPage < Workstation::BasePage
    include PageObject

    page_url "/account/editlabelcontact"

    text_field(:user_name, id: "login")
    text_field(:email_address, id: "contact_email")
    text_field(:contact_first_name, id: "contact_first_name")
    text_field(:contact_last_name, id: "contact_last_name")
    text_field(:contact_phone, id: "contact_phone")
    text_field(:company, id: "company")
    text_field(:contact_title, id: "contact_title")
    text_field(:address_street, id: "address_street")
    checkbox(:role_id, id: "role_id_4")
    text_field(:password, id: "passwords")
    text_field(:verify_password, id: "verify_password")
    button(:create_user_button, id: "submit_labelcontact_form")

    def populate_user_basics(data)
      self.email_address = data["email_address"]
      self.contact_phone = data["contact_phone"]
      self.company = data["company"]
      self.contact_title = data["contact_title"]
      self.address_street = data["address_street"]
      self.password = data["password"]
      self.verify_password = data["verify_password"]
    end

    def populate_auth0_user_basics(data)
      self.email_address = data["email_address"]
      self.contact_phone = data["contact_phone"]
      self.company = data["company"]
      self.contact_title = data["contact_title"]
      self.address_street = data["address_street"]
    end
  end
end
