package cz.moneta.test.dsl.ufo.banka.pages.loans.creditCard;

import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.endpoints.ufo.UfoEndpoint;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.CustomAction;
import cz.moneta.test.harness.support.web.Lookup;
import cz.moneta.test.harness.support.web.Wait;
import cz.moneta.test.harness.support.web.WebFlow;

import static cz.moneta.test.dsl.ufo.banka.pages.loans.creditCard.NKK004_S001_ProductTransferPage.SEND_BUTTON;

@Wait(SEND_BUTTON)
public interface NKK004_S001_ProductTransferPage extends WebFlow<NKK004_S001_ProductTransferPage>, StoreAccessor {
    String SEND_BUTTON = "NKK004_S001_B001";
    String CREDIT_ACCOUNT_BUTTON_XPATH = "//td[text()='Kreditní účet']";

    @Click(value = CREDIT_ACCOUNT_BUTTON_XPATH, by = Lookup.XPATH)
    NKK004_S001_ProductTransferPage clickCreditAccount();

    @CustomAction
    default NKK004_S001_ProductTransferPage clickSendButton() {
        UfoEndpoint endpoint = getEndpoint(UfoEndpoint.class);
        endpoint.click(() -> SEND_BUTTON);
        endpoint.dismissAlert(20);
        return null;
    }

}
