package cz.moneta.test.dsl.brokerportal.components;

import cz.moneta.test.dsl.brokerportal.contract.VictoryScreenPage;
import cz.moneta.test.dsl.brokerportal.contract.fullapplication.FullApplicationVictoryModal;
import cz.moneta.test.harness.support.web.*;

import static cz.moneta.test.dsl.brokerportal.components.ApplicationSignModal.SEND_SMS_BUTTON;

@Wait(SEND_SMS_BUTTON)
public interface ApplicationSignModal extends WebFlow<ApplicationSignModal> {
    String SEND_SMS_BUTTON = "//button[@id = 'signModalSendSMS']";
    String SEND_NEW_SMS_BUTTON = "//button[@id = 'signModalSendNewCode']";
    String SEND_NEW_SMS_BUTTON_DISABLED = SEND_NEW_SMS_BUTTON + "[@disabled]";
    String SIGN_BUTTON = "//button[@id = 'signModalSendCode']";
    String SMS_CODE_INPUT = "//input[@name = 'code']";

    @Click(value = SEND_SMS_BUTTON, andWait = @Wait(value = SMS_CODE_INPUT, until = Until.VISIBLE))
    ApplicationSignModal clickSendSmsButton();

    @Click(value = SEND_NEW_SMS_BUTTON, andWait = @Wait(value = SEND_NEW_SMS_BUTTON_DISABLED, until = Until.GONE))
    ApplicationSignModal clickSendNewSmsButton();

    @Click(SIGN_BUTTON)
    VictoryScreenPage clickSignShortApplicationButton();

    @Click(SIGN_BUTTON)
    FullApplicationVictoryModal clickSignFullApplicationButton();

    @TypeInto(SMS_CODE_INPUT)
    ApplicationSignModal fillSmsCode(String smsCode);
}