package cz.moneta.test.dsl.monetaportal.savings.childbuildingsavings;

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

import static cz.moneta.test.dsl.monetaportal.savings.childbuildingsavings.ConsentsPage.PAGE_HEADER;

@Wait(value = PAGE_HEADER, waitSecondsForElement = 60)
public interface ConsentsPage extends ChildBuildingSavingsPageFlow<ConsentsPage> {
    String PAGE_HEADER = "//h2[text()='Nejdříve zvolte věk dítěte a poté si připravte potřebné dokumenty']";
    String AGE_LESS_THAN_15 = "//div[./p [text()='0 - 14 let']]";
    String AGE_MORE_THAN_14_AND_LOWER_THAN_19 = "//div[./p [text()='15 - 18 let']]";
    String AGREE_AND_CONTINUE = "//button[text()='Souhlasím a pokračovat']";

    @Click(AGE_LESS_THAN_15)
    ConsentsPage clickLessThan15();

    @Click(AGE_MORE_THAN_14_AND_LOWER_THAN_19)
    ConsentsPage clickMoreThan14();

    @Click(AGREE_AND_CONTINUE)
    PersonalDetailPage clickAgreeAndContinue();

    @CustomAction
    default ConsentsPage chooseAge(boolean isYoung) {
        if (isYoung) clickLessThan15();
        else clickMoreThan14();
        return null;
    }

}
