package cz.moneta.test.dsl.monetaportal.components.forms;

import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.support.web.*;

import static cz.moneta.test.dsl.monetaportal.components.forms.AlaCarteLoanForm.A_LA_CARTE_FORM_FIRSTNAME_INPUT;

@Wait(A_LA_CARTE_FORM_FIRSTNAME_INPUT)
public interface AlaCarteLoanForm extends WebFlow<AlaCarteLoanForm>, StoreAccessor {

    String A_LA_CARTE_FORM_DIV = "//div[contains(@class, 'UnifiedOnboarding__left___')]";
    String A_LA_CARTE_FORM_FIRSTNAME_INPUT = A_LA_CARTE_FORM_DIV + "//input[@id = 'firstName']";
    String A_LA_CARTE_FORM_LASTNAME_INPUT = A_LA_CARTE_FORM_DIV + "//input[@id = 'lastName']";
    String A_LA_CARTE_FORM_EMAIL_INPUT = A_LA_CARTE_FORM_DIV + "//input[@id = 'email']";
    String A_LA_CARTE_FORM_PHONENUMBER_INPUT = A_LA_CARTE_FORM_DIV + "//input[@id = 'phoneNumber']";
    String A_LA_CARTE_FORM_MAILINGAGREEMENT_CHECKBOX = A_LA_CARTE_FORM_DIV + "//input[@name = 'mailingAgreement']/..";
    String A_LA_CARTE_FORM_GDPRAGREEMENT_CHECKBOX = A_LA_CARTE_FORM_DIV + "//input[@name = 'gdprAgreement']/..";
    String A_LA_CARTE_FORM_WHATSAPPAGREEMENT_CHECKBOX = A_LA_CARTE_FORM_DIV + "//input[@name = 'whatsAppAgreement']/..";
    String A_LA_CARTE_FORM_CONFIRM_BUTTON = A_LA_CARTE_FORM_DIV + "//button[contains(@class, 'btn btn-tertiary')]";
    String A_LA_CARTE_FORM_QR_CODE = "//div[contains(@class, 'Result__qr___')]";

    @TypeInto(value = A_LA_CARTE_FORM_FIRSTNAME_INPUT, clear = true)
    AlaCarteLoanForm fillLoanFormFirstname(String LoanFormFirstname);

    @TypeInto(value = A_LA_CARTE_FORM_LASTNAME_INPUT, clear = true)
    AlaCarteLoanForm fillLoanFormLastname(String LoanFormLastname);

    @TypeInto(value = A_LA_CARTE_FORM_EMAIL_INPUT, clear = true)
    AlaCarteLoanForm fillLoanFormEmail(String LoanFormEmail);

    @TypeInto(value = A_LA_CARTE_FORM_PHONENUMBER_INPUT, clear = true)
    AlaCarteLoanForm fillLoanFormPhoneNumber(String LoanFormPhoneNumber);

    @Click(A_LA_CARTE_FORM_MAILINGAGREEMENT_CHECKBOX)
    AlaCarteLoanForm clickLoanFormMailingAgreement();

    @Click(A_LA_CARTE_FORM_GDPRAGREEMENT_CHECKBOX)
    AlaCarteLoanForm clickLoanFormGdprAgreement();

    @Click(A_LA_CARTE_FORM_WHATSAPPAGREEMENT_CHECKBOX)
    AlaCarteLoanForm clickLoanFormWhatsAppAgreement();

    @Click(A_LA_CARTE_FORM_CONFIRM_BUTTON)
    AlaCarteLoanForm clickLoanFormConfirm();

    @Wait(A_LA_CARTE_FORM_QR_CODE)
    @CheckElementPresent(A_LA_CARTE_FORM_QR_CODE)
    AlaCarteLoanForm checkQRCode();
}