package cz.moneta.test.regression.backoffice.callcenter.jenkinstests.ccretail.cczakladbanka;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.util.credentials.Keys;
import cz.moneta.test.dsl.util.task.ufo.operations.OperationsTasks;
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 org.junit.jupiter.api.BeforeAll;

import static cz.moneta.test.harness.annotations.Environment.PPE;
import static cz.moneta.test.harness.annotations.Environment.TST1;

@TestScenario(name = "Current accounts tests")
public class CurrentAccountTests {

    private OperationsTasks operationsTasks;
    private String rcOfExistingClient;

    @BeforeAll
    public void getInfo(Harness harness) {
        operationsTasks = harness.tasks().ufo().operations();
        rcOfExistingClient = harness.getSystemOrConfigValue("cc.currentAccountTests.rc");
    }

    @TestCase(name = "Current account - Free bank statements", environments = {PPE, TST1})
    @JiraTestCase(id = "CC-T2097")
    public void currentAccountFreeBankStatements(Harness harness, @Key(Keys.ufo.banka.banker) Credentials credentials){

        harness.withUfo()
                .openLoginPage()
                .then(operationsTasks.login().withCredentials(credentials))
                .then(operationsTasks.currentAccountTasks().stepsToFirstAccountStatement(rcOfExistingClient))
                .clickStatementWithoutFeeButton()
                .then(operationsTasks.currentAccountTasks().checkIbSbCheckboxAndCheckRequirement());
    }

    @TestCase(name = "Current account - Bank statements with fee", environments = {PPE, TST1})
    @JiraTestCase(id = "CC-T2096")
    public void currentAccountBankStatementsWithFee(Harness harness, @Key(Keys.ufo.banka.banker) Credentials credentials){

        harness.withUfo()
                .openLoginPage()
                .then(operationsTasks.login().withCredentials(credentials))
                .then(operationsTasks.currentAccountTasks().stepsToFirstAccountStatement(rcOfExistingClient))
                .clickStatementWithFeeButton()
                .then(operationsTasks.currentAccountTasks().checkIbSbCheckboxAndCheckRequirement())
                .clickAccountList()
                .selectFirstCurrentAccCombobox(1)
                .clickTransactions()
                .checkFirstStatementValue("300");
    }
}
