package cz.moneta.test.regression.transactional.cards.commercial;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.ufo.banka.tasks.accountenums.DebitCardFeePlan;
import cz.moneta.test.dsl.ufo.banka.tasks.BankaTasks;
import cz.moneta.test.dsl.util.data.client.NonClient;
import cz.moneta.test.harness.annotations.Defect;
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.TST1;

@TestScenario(name = "ONB.COM.DC.06 - Commercial DC - Existing Account - Card Onboarding - (Debit MC Business Premium (Gold)) - PO - BRANCH")
public class DebitMcBusinessPremium {

    NonClient nonClient;

    @BeforeEach
    void setUp(Harness harness, @Key(ufo.banka.banker) Credentials credentials) {
        nonClient = harness.data().newFVNonClientEmployee()
                .withNetMonthlyIncome(100000)
                .withHomeIncome(100000)
                .withOtherExpenses(30000)
                .withOtherLoanPayments(0)
                .withWageDeductions(0);
        //.withIco("19644981");
    }

    @Defect("Not Finished")
    @TestCase(name = "ONB.COM.DC.06 - Commercial DC - Existing Account - Card Onboarding - (Debit MC Business Premium (Gold)) - PO - BRANCH", environments = {TST1})
    public void fromBranchCommercialDc(Harness harness, @Key(ufo.banka.banker) Credentials credentials) {

        BankaTasks bankaTasks = harness.tasks().ufo().banka();
        harness.withUfo()
                .openLoginPage()
                .then(bankaTasks.login().withCredentialsAndTurnOffSignpad(credentials))
                .then(bankaTasks.newFopClient().createFopCif(nonClient));

        final String cardName = "Debit MC Business Premium (Gold) (FV)|";

        harness.withUfo().openLoginPage()
                .then(bankaTasks.login().withCredentialsAndTurnOffSignpad(credentials))
                .then(bankaTasks.search().findByIco(nonClient.ico()))
                .then(bankaTasks.newSmeProducts().createNewSmeCurrentAccountDC())
                .then(bankaTasks.newProduct().createNewDebitCardForExistingCurrentAccount(cardName, DebitCardFeePlan.FREE));
    }
}
