package cz.moneta.test.regression.risk.applications.newclient;

import cz.moneta.test.dataprepare.risk.DefaultLoan;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.util.code.lists.HCisAllStavZadosti;
import cz.moneta.test.dsl.util.data.client.Address;
import cz.moneta.test.dsl.util.data.client.Employer;
import cz.moneta.test.dsl.util.data.client.IdCard;
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 java.time.LocalDate;

import static cz.moneta.test.dsl.util.credentials.Keys.ufo.banka.banker;

@TestScenario(name = "Test for Risk Retail - Data preparation - client with Expres Loan application")
public class ExpressLoanApplication extends DefaultLoan {

    @TestCase
    @JiraTestCase(id = "RISK-T2071")
    public void newClientWithExpressLoanApplication(Harness harness, @Key(banker) Credentials credentials) {
        applicant.withEmployer(new Employer("Pianoclassic s.r.o.", "17466865", Address.builder().street("Hvězdova").descriptiveNumber("1716").orientationNumber("2b").city("Praha").zip("14000").country("CZ").build(), "733303555"));
        applicant  .withIdCard(new IdCard("212595668", LocalDate.of(2015, 1, 19), LocalDate.of(2031, 1, 19)));
        bankaTasks.newClient().openUfoAndCreateClient(harness, credentials, applicant)
                .then(bankaTasks.expresTasks().createNewExpressApplication(applicant, LOAN_AMOUNT, TERM, HCisAllStavZadosti.DOCUMENTS_REQUIRED));
    }
}
