package cz.moneta.test.regression.backoffice.ufooperations.old;

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.Disabled;

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

@Disabled
@TestScenario(name = "IB blockation and unblockation")
public class InternetBankaBlockUnblock {

    private static final String ACTIVE = "Aktivní";
    private static final String BLOCKED = "Blokovaný";

    @TestCase(name = "IB blockation and unblockation", environments = {PPE, TST1, EDU})
    @JiraTestCase(id = "BOC-T3961")
    public void blockingAndUnblocking(Harness harness, @Key(Keys.ufo.banka.banker) Credentials credentials) {
        OperationsTasks operationsTasksTasks = harness.tasks().ufo().operations();
        String rcOfExistingClient = harness.getConfig("ufo.operations.rc-of-existing-client");

        harness.withUfo()
                .openLoginPage()
                .then(operationsTasksTasks.login().withCredentials(credentials))
                .clickRcRadio()
                .fillSearchInput(rcOfExistingClient)
                .clickSearchClient()
                .onClientDetailsPage()
                .clickAdcList()
                .clickBlockMobileKey()
                .assertMobileKeyStatus(BLOCKED)
                .clickBlockMobileKey()
                .assertMobileKeyStatus(ACTIVE)
                .selectIBBlocationReason("Vlastní žádost klienta")
                .clickBlockInternetBanka()
                .assertInternetBankaStatus(BLOCKED)
                .clickUnblockInternetBanka()
                .assertInternetBankaStatus(ACTIVE)
                .selectIBBlocationReason("Žádost banky")
                .clickBlockInternetBanka()
                .assertInternetBankaStatus(BLOCKED)
                .clickUnblockInternetBanka()
                .assertInternetBankaStatus(ACTIVE);
    }
}