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

import cz.moneta.dataprepare.CustomerDataPrepare;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.ufo.banka.tasks.BankaTasks;
import cz.moneta.test.dsl.util.credentials.Keys;
import cz.moneta.test.dsl.util.data.client.Employer;
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.*;

@Disabled
@TestScenario(name = "Teller must be able to crate a new customer with uzofka")
public class CreateNewCustomerWithUzofka extends CustomerDataPrepare {

    private static final int DEFAULT_LOAN_AMOUNT = 50000;
    private static final int SHORT_TERM = 24;

    @TestCase(name = "Bank teller is able to login and create a new customer with uzofka", environments = {TST1, PPE, EDU})
    @JiraTestCase(id = "POB-T19502")
    public void createNewCustomerWithUzofka(Harness harness, @Key(Keys.ufo.banka.banker) Credentials banker) {
        BankaTasks tasks = harness.tasks().ufo().banka();
        String otherApplicantBirthNumber = harness.getConfig("branch.squad.rc.client");
        nonClient.withEmployer(Employer.builder().ico("75643375").name("Petr Ráab").phoneNumber("756456854").build());

        harness.withUfo()
                .openLoginPage()
                .then(tasks.login().withCredentialsAndTurnOffSignpad(banker))
                .then(tasks.search().findByCif(newCustomerCif))
                .clickEdit()
                .onChangeDataFO()
                .storeAddress()
                .storeDependantsNumber()
                .clickBack()
                .onMainClientPage()
                .then(tasks.newProduct().createUzofkaWithOtherApplicant(nonClient, DEFAULT_LOAN_AMOUNT, SHORT_TERM, otherApplicantBirthNumber));
    }
}
