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

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

import static cz.moneta.test.dsl.monetaportal.components.Web2Call.W2C_INPUT;

@Wait(value = {W2C_INPUT})
public interface Web2Call extends WebFlow<Web2Call>, StoreAccessor {

    //W2C
    String W2C_DIV = "//div[@id='W2cModal']";
    String W2C_INPUT = "//input[@name='phoneNumber']";
    String W2C_SUBMIT_BUTTON = "//button[@type='submit' and .//*[@data-message-id='w2c.ContactForm.submit']]";
    String W2C_SUCCESS_MESSAGE = "//span[@data-message-id='w2c.W2cResponse.responseMessage']";
    String W2C_MODAL_CLOSE_BUTTON = "//button[@id='modal__header__close-button']";

    //W2C
    @Click(W2C_INPUT)
    Web2Call clickW2CPhone();

    @Click(W2C_SUBMIT_BUTTON)
    Web2Call clickW2CSubmit();

    @TypeInto(value = W2C_INPUT, clear = true)
    Web2Call fillW2CPhone(String phoneNumber);

    @CheckElementPresent(W2C_SUCCESS_MESSAGE)
    Web2Call checkW2CSuccessMessage();

    @Click(W2C_MODAL_CLOSE_BUTTON)
    Web2Call clickW2CModalClose();
}
