package cz.moneta.test.dsl.ufo.banka.pages.main;

import cz.moneta.test.dsl.ufo.banka.pages.cards.credit.HPO039_S001_MbcDetailPageTransitions;
import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.endpoints.ufo.UfoEndpoint;
import cz.moneta.test.harness.support.web.*;

import static cz.moneta.test.dsl.ufo.banka.pages.main.HPO022_S001_BusinessKontokorentPage.*;

@Wait(value = HPO022_S001_PAGE_LABEL_XPATH, waitSecondsForElement = 60, by = Lookup.XPATH)
public interface HPO022_S001_BusinessKontokorentPage extends WebFlow<HPO022_S001_BusinessKontokorentPage>, StoreAccessor {
    String HPO022_S001_PAGE_LABEL_XPATH = "//div[text()='HPO022_S001']";

    String CHANGE_FRAME_BUTTON = "HPO022_S001_I008";

    String DECREASE_FRAME_BUTTON = "HPO022_S001_B001";
    String INCREASE_FRAME_BUTTON = "HPO022_S001_B002";

    String RETURN_TO_CLIENT_DIV = "HPO022_S001_S014";
    String ACOUNT_NUMBER_INTERNAL_DIV = "HPO022_S001_L001";

    @CustomAction
    default HPO039_S001_MbcDetailPageTransitions mouseOverFrameChangeAndDecrease() {
        UfoEndpoint endpoint = getEndpoint(UfoEndpoint.class);
        endpoint.moveToElement(CHANGE_FRAME_BUTTON);
        endpoint.click(() -> DECREASE_FRAME_BUTTON);
        return null;
    }

    @CustomAction
    default HPO039_S001_MbcDetailPageTransitions mouseOverFrameChangeAndIncrease() {
        UfoEndpoint endpoint = getEndpoint(UfoEndpoint.class);
        endpoint.moveToElement(CHANGE_FRAME_BUTTON);
        endpoint.click(() -> INCREASE_FRAME_BUTTON);
        return null;
    }

    @Click(value = RETURN_TO_CLIENT_DIV, jsClick = true)
    HKO101_S001_MainClientPage returnToMainClient();

    @CheckElementContent(ACOUNT_NUMBER_INTERNAL_DIV)
    HPO022_S001_BusinessKontokorentPage checkAccountNumberInternal(String accountNumber);
}
