package cz.moneta.test.regression.channels.branch.archive;

import cz.moneta.dataprepare.CustomerDataPrepare;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.ufo.banka.tasks.BankaTasks;
import cz.moneta.test.dsl.util.credentials.Keys;
import cz.moneta.test.harness.annotations.JiraTestCase;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;
import cz.moneta.test.harness.support.auth.Credentials;
import cz.moneta.test.harness.support.auth.Key;
import cz.moneta.test.harness.support.data.GeneratorType;
import org.junit.jupiter.api.Disabled;

import static cz.moneta.test.harness.annotations.Environment.*;

@Disabled
@TestScenario(name = "Create new SIPO payment")
public class CreateNewSIPOPayment extends CustomerDataPrepare {

    @TestCase(name = "Create new SIPO Payment", environments = {TST1, PPE, EDU})
    @JiraTestCase(id = "POB-T10641")
    public void tc_create_new_SIPO_payment(Harness harness, @Key(Keys.ufo.banka.banker) Credentials credentials) {
        BankaTasks bankaTasks = harness.tasks().ufo().banka();
        String sipoNumber = harness.generate(GeneratorType.SIPO);
        String limitAmount = "300";

        harness.withUfo()
                .openLoginPage()
                .then(bankaTasks.login().withCredentialsAndTurnOffSignpad(credentials))
                .then(bankaTasks.search().findByCif(newCustomerCif))
                .then(bankaTasks.newProduct().createNewCurrentAccount("Tom Plus"))
                .checkProductActive("Běžný účet")
                .openCurrentAccountDetailPage()
                .openListOfSIPOPayments()
                .clickCreate()
                .fillSIPONumber(sipoNumber)
                .fillLimitAmount(limitAmount)
                .clickSaveToPrintPage()
                .closePrintWindow()
                .onDocumentConfirmationPage()
                .clickSigned()
                .clickOk()
                .chooseSipoPayment()
                .clickDeactivate()
                .clickSaveAndPrint()
                .closePrintWindow()
                .onPrintInstructionPage()
                .clickRightButton()
                .onListOfSIPOPaymentsPage();
    }
}
