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

import static cz.moneta.test.dsl.ufo.banka.pages.cards.credit.CreditCardsAdvantages.TRAVEL_AND_SPORT;
import static cz.moneta.test.dsl.ufo.banka.pages.cards.credit.CreditCardsPromo.NO_PROMO;
import static cz.moneta.test.dsl.ufo.banka.tasks.accountenums.CurrentAccountsEnum.TOM_PLUS;
import static cz.moneta.test.dsl.util.credentials.Keys.ufo;
import static cz.moneta.test.harness.annotations.Environment.*;

@Disabled("Duplicates Cards team - CT-T9681")
@TestScenario(name = "Teller must be able to crate a new customer with credit card")
public class CreateNewCustomerWithCreditCard {

    NonClient nonClient;

    @JiraTestCase(id = "POB-T18555")
    @TestCase(name = "Bank teller is able to login and create a new customer with credit card", environments = {TST1, PPE, EDU})
    public void tcBankTellerIsAbleCreateNewCustomerWithCreditCard(Harness harness, @Key(ufo.banka.banker) Credentials credentials) {
        nonClient = harness.data().newFVNonClient()
                .withNetMonthlyIncome(100000)
                .withHomeIncome(100000)
                .withOtherExpenses(5000)
                .withOtherLoanPayments(0);

        String creditAmount = "50000";

        BankaTasks bankaTasks = harness.tasks().ufo().banka();
        harness.withUfo()
                .openLoginPage()
                .then(bankaTasks.login().withCredentialsAndTurnOffSignpad(credentials))
                .then(bankaTasks.newClient().create(nonClient, credentials.getUsername()))
                .then(bankaTasks.newPackagedProductTasks().ibWithMobileKeyAndCurrentAccount(nonClient, TOM_PLUS))
                .then(bankaTasks.newProduct().createNewCreditCardByQuickRequest(nonClient, TRAVEL_AND_SPORT, NO_PROMO, creditAmount))
                .checkProductActive("Kreditní karta");
    }
}