package cz.moneta.test.regression.transactional.cards.retail.debitcard.origination;

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.data.client.NonClient;
import cz.moneta.test.harness.annotations.Defect;
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.BeforeEach;

import static cz.moneta.test.dsl.util.credentials.Keys.ufo;
import static cz.moneta.test.harness.annotations.Environment.TST3;

@TestScenario(name = "ONB.RET.DC.40 - Retail DC - Account&Card Onboarding (EUR - Debit MC Standard EUR)")
public class Client_fromBranch_toBranch_Eur {

    NonClient nonClient;

    @BeforeEach
    void setUp(Harness harness, @Key(ufo.banka.banker) Credentials credentials) {
        nonClient = harness.data().newFVNonClient()
                .withNetMonthlyIncome(100000)
                .withHomeIncome(100000)
                .withOtherExpenses(5000)
                .withOtherLoanPayments(0);

//        nonClient.withBirthNumber("6411064946");

        BankaTasks bankaTasks = harness.tasks().ufo().banka();
        harness.withUfo()
                .openLoginPage()
                .then(bankaTasks.login().withCredentialsAndTurnOffSignpad(credentials))
                .then(bankaTasks.newClient().create(nonClient, credentials.getUsername()))
//                .fillSearchTerm(nonClient.birthNumber())
//                .clickSearchByRc()
//                .onClientDetailPage()
                .then(bankaTasks.newPackagedProductTasks().ibWithMobileKeyAndCurrentAccount(nonClient, CurrentAccountsEnum.GENIUS_GOLD));
    }

    @Defect(value = "Not Finished", environments = {TST3})
    @JiraTestCase(id = "FVP-T306")
    @TestCase(name = "Banker creates Standard Account (EUR) and Debit card (Debit MC Standard EUR) for an existing client with existing account Genius Gold", environments = {TST3})
            public void Retail_CC_Application_Origination_MoneyCard_Smart_BRANCH(Harness harness, @Key(ufo.banka.banker) Credentials credentials) {

        BankaTasks bankaTasks = harness.tasks().ufo().banka();
        harness.withUfo()
                .openLoginPage()
                .then(bankaTasks.login().withCredentialsAndTurnOffSignpad(credentials))
                .fillSearchTerm(nonClient.birthNumber())
                .clickSearchByRc()
                .onClientDetailPage()
                .then(bankaTasks.newProduct().createNewCurrentAccount(CurrentAccountsEnum.TOM));
//                .then(bankaTasks.newProduct().createNewCurrentAccountWithoutContactAddress(CurrentAccountsEnum.TOM));

    }
}
