package cz.moneta.test.dsl.newib.settings.envelopes;
import cz.moneta.test.dsl.newib.NewIbPageFlow;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.TypeInto;
import cz.moneta.test.harness.support.web.Wait;
import static cz.moneta.test.dsl.newib.settings.envelopes.CreateNewEnvelopePage.*;

@Wait(value = {NEW_ENVELOPE_TITLE_XPATH, SUBMIT_BTN_XPATH, BACK_BTN_XPATH}, waitSecondsForElement = 30)
public interface CreateNewEnvelopePage extends NewIbPageFlow<CreateNewEnvelopePage>, StoreAccessor {
    String NEW_ENVELOPE_TITLE_XPATH = "//h1[@class='t-title t-title--h3'][text()='Nová spořicí obálka']";
    String NAME_INPUT_XPATH = "//input[@id='name']";
    String AMOUNT_INPUT_XPATH = "//input[@id='amount']";
    String CAR_ICON_BTN_XPATH = "//button[contains(@class, 'c-btn--transparent')]//img[contains(@src, 'category-icons/%s.png')]";
    String SUBMIT_BTN_XPATH = "//button[@data-testid='submit']";
    String BACK_BTN_XPATH = "//button[@data-testid='back']";

    @TypeInto(NAME_INPUT_XPATH)
    CreateNewEnvelopePage setEnvelopeName(String name);

    @TypeInto(AMOUNT_INPUT_XPATH)
    CreateNewEnvelopePage setAmount(String amount);

    @Click(value = CAR_ICON_BTN_XPATH, isStringDynamicXpath = true)
    @Click(value = SUBMIT_BTN_XPATH, andWait = @Wait(explicitWaitSeconds = 1))
    CreateEnvelopeVictoryPage submitNewEnvelope(String category);
}