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

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.ufo.banka.tasks.BankaTasks;
import cz.moneta.test.dsl.ufo.banka.tasks.accountenums.CurrentAccountsEnum;
import cz.moneta.test.dsl.util.credentials.Keys;
import cz.moneta.test.dsl.util.data.client.NonClient;
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 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 = "The banker must be able to create a bank account with access to IB for a new customer")
public class CreateNewCustomerWithIb {

    private NonClient nonClient;
    private String newCustomerCif;

    @BeforeAll
    public void setUp(Harness harness, @Key(Keys.ufo.banka.banker) Credentials banker) {

        nonClient = harness.data().newNonClient()
                .withMobileNumber("725559544");

        newCustomerCif = harness.dataPrepare()
                .createNewFoCustomerViaWso2AndGetCif(nonClient, banker.getUsername());
    }

    @TestCase(name = "Bank teller is able to login, create current account with access to IB for a new customer", environments = {TST1, PPE, EDU})
    @JiraTestCase(id = "POB-T19519")
    public void tcBankTellerIsAbleCreateNewCustomerWithAccessToIb(Harness harness, @Key(Keys.ufo.banka.banker) Credentials banker) {
        BankaTasks bankaTasks = harness.tasks().ufo().banka();

        harness.withUfo()
                .openLoginPage()
                .then(bankaTasks.login().withCredentialsAndTurnOffSignpad(banker))
                .then(bankaTasks.search().findByCif(newCustomerCif))
                .then(bankaTasks.newPackagedProductTasks().ibWithMobileKeyAndCurrentAccountAfterSearchCif(nonClient.mobileNumber(), CurrentAccountsEnum.TOM_PLUS));
    }
}
