package cz.moneta.test.dsl.ib.payment.domestic;

import cz.moneta.test.dsl.ib.IbPageFlow;
import cz.moneta.test.dsl.ib.components.AccountsAndTransactionsSubmenu;
import cz.moneta.test.dsl.ib.components.MainMenu;
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.ib.payment.domestic.PaymentOrderAuthorizePage.FORM_DIV;

@Wait(value = FORM_DIV)
public interface PaymentOrderAuthorizePage extends IbPageFlow<PaymentOrderAuthorizePage>, MainMenu, AccountsAndTransactionsSubmenu {

    String SIGN_BUTTON = "//a[@id='sign-button']";
    String SIGN_MASS_PAYMENT_BUTTON = "//img[@alt='Podepsat']";
    String SEND_BUTTON = "//a[@id='commit-button']";
    String SEND_MASS_PAYMENT_BUTTON = "//a[@id='sendBtn']";
    String SMS_CODE_IPUT = "//input[@id='mobile-key']";
    String SMS_CODE_MASS_PAYMENT_INPUT = "//input[@id='SMSCode']";
    String RESULT_DIV = "//div[@id='payment-result-content']";
    String SAVE_TO_SIGN = "//a[@id='send-to-waiting-room-button']";
    String FORM_DIV = "//div[@id='x31809652']";

    @Click(SIGN_BUTTON)
    PaymentOrderAuthorizePage clickSign();

    @Click(SIGN_MASS_PAYMENT_BUTTON)
    PaymentOrderAuthorizePage clickSignMassPayment();

    @Click(value = SAVE_TO_SIGN, andWait = @Wait(value = RESULT_DIV, until = Until.VISIBLE, waitSecondsForElement = 60))
    PaymentOrderConfirmationPage clickSaveToSign();

    @Click(value = SIGN_BUTTON, andWait = @Wait(value = RESULT_DIV, until = Until.VISIBLE, waitSecondsForElement = 60))
    PaymentOrderConfirmationPage clickSignTransferBetweenOwnAcc();

    @TypeInto(SMS_CODE_IPUT)
    PaymentOrderAuthorizePage typeSmsCode(String smsCode);

    @TypeInto(SMS_CODE_MASS_PAYMENT_INPUT)
    PaymentOrderAuthorizePage typeSmsCodeMassPayment(String smsCode);

    @Click(value = SEND_BUTTON, andWait = @Wait(value = RESULT_DIV, until = Until.VISIBLE, waitSecondsForElement = 60))
    PaymentOrderConfirmationPage clickSend();

    @Click(SEND_MASS_PAYMENT_BUTTON)
    PaymentOrderConfirmationPage clickSendMassPayment();
}
