package cz.moneta.test.dsl.hypos.pages.contract.hyposutils;

import cz.moneta.test.dsl.hypos.pages.HyposPageFlow;
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.Until;
import cz.moneta.test.harness.support.web.Wait;

import static cz.moneta.test.dsl.hypos.pages.contract.hyposutils.TestDrawVerificationPage.SEARCH_DRAW_BUTTON;
import static cz.moneta.test.dsl.hypos.pages.contract.hyposutils.TestDrawVerificationPage.SEARCH_DRAW_INPUT;

@Wait({SEARCH_DRAW_INPUT, SEARCH_DRAW_BUTTON})
public interface TestDrawVerificationPage extends HyposPageFlow<TestDrawVerificationPage>, StoreAccessor {
    String SEARCH_DRAW_INPUT = "//input[@name='c']";
    String SEARCH_DRAW_BUTTON = "//button[text()='Vyhledat čerpání obchodu']";
    String DRAW_CHECKBOX_INPUT = "//input[@name='ids[]']";
    String SUBMIT_DRAW_BUTTON = "//button[text()='Verifikovat vybrané']";

    @TypeInto(SEARCH_DRAW_INPUT)
    TestDrawVerificationPage fillContractToSearch(String contractId);

    @Click(value = SEARCH_DRAW_BUTTON, andWait = @Wait(value = DRAW_CHECKBOX_INPUT, until = Until.VISIBLE))
    TestDrawVerificationPage clickSearchButton();

    @Click(DRAW_CHECKBOX_INPUT)
    TestDrawVerificationPage clickDrawCheckbox();

    @Click(value = SUBMIT_DRAW_BUTTON, andWait = @Wait(value = DRAW_CHECKBOX_INPUT, waitSecondsForElement = 30, until = Until.GONE))
    TestDrawVerificationPage clickVerifyDraw();
}
