package cz.moneta.test.dsl.newib.settings.envelopes;

import cz.moneta.test.dsl.newib.NewIbPageFlow;
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.EditEnvelopePage.*;

@Wait(value = {EDIT_ENVELOPE_TITLE_XPATH, SUBMIT_BTN_XPATH, BACK_BTN_XPATH}, waitSecondsForElement = 30)
public interface EditEnvelopePage extends NewIbPageFlow<EditEnvelopePage> {
    String EDIT_ENVELOPE_TITLE_XPATH = "//h1[@class='t-title t-title--h3'][text()='Upravit obálku']";
    String NAME_INPUT_XPATH = "//input[@id='name']";
    String AMOUNT_INPUT_XPATH = "//input[@id='amount']";
    String SUBMIT_BTN_XPATH = "//button[@data-testid='submit']";
    String BACK_BTN_XPATH = "//button[@data-testid='back']";

    @TypeInto(value = NAME_INPUT_XPATH, clear = true)
    EditEnvelopePage changeEnvelopeName(String name);

    @TypeInto(value = AMOUNT_INPUT_XPATH, clear = true)
    EditEnvelopePage changeAmount(String amount);

    @Click(value = SUBMIT_BTN_XPATH, andWait = @Wait(explicitWaitSeconds = 1))
    EditEnvelopeVictoryPage submitEditedEnvelope();
}