package cz.moneta.test.dsl.oauth2.web;

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

import static cz.moneta.test.dsl.oauth2.web.ApproveAccessToAccountPageKyc.MONETA_LOGO_IMG;

@Wait(MONETA_LOGO_IMG)
public interface ApproveAccessToAccountPageKyc extends WebFlow<Oauth2WebTransitions> {

    String MONETA_LOGO_IMG = "//img[@alt='MONETA logo']";
    String YES_CONFIRM_IDENTITY_BUTTON = "//button[@testid='button']/span[contains(text(),'Ano, chci ověřit svou identitu')" +
            " or contains(text(), 'Yes, I want to confirm my identity')]";
    String ID_INPUT = "//input[@name='id']";
    String PASSWORD_INPUT = "//input[@name='password']";
    String SUBMIT_MOBIL_KEY_SEND_BUTTON = "//button[@type='submit']/span[contains(text(),'Odeslat mobilní klíč') or contains(text(), 'Send mobile key')]";
    String CONTINUE_BUTTON = "//button[@type='submit']/span[contains(text(),'Pokračovat') or contains(text(), 'Grant access')]";
    String SMS_KEY_INPUT = "//input[@name='smsKey']";

    @Click(value = YES_CONFIRM_IDENTITY_BUTTON, andWait = @Wait(ID_INPUT))
    ApproveAccessToAccountPageKyc clickYesConfirmButton();

    @TypeInto(ID_INPUT)
    ApproveAccessToAccountPageKyc fillIdInput(String id);

    @TypeInto(PASSWORD_INPUT)
    ApproveAccessToAccountPageKyc fillPasswordInput(String password);

    @TypeInto(SMS_KEY_INPUT)
    ApproveAccessToAccountPageKyc fillSmsKey(String smsKey);

    @Click(value = SUBMIT_MOBIL_KEY_SEND_BUTTON, andWait = @Wait(CONTINUE_BUTTON))
    ApproveAccessToAccountPageKyc clickSendMobileKey();

    @Click(CONTINUE_BUTTON)
    ThirdPartyApplicationPageWithToken continueButton();
}