package cz.moneta.test.system.ihub;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.mwf.createcustomer.MWF109;
import cz.moneta.test.dsl.mwf.createcustomer.MWF109Response;
import cz.moneta.test.dsl.ufo.mwf.MWFHK8;
import cz.moneta.test.dsl.util.DateUtils;
import cz.moneta.test.dsl.util.TestUtils;
import cz.moneta.test.dsl.util.data.client.NonClient;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;
import org.junit.jupiter.api.Assertions;

@Deprecated
@TestScenario(name = "Checks if birth number is already in use by the systems")
public class CreateCIF {

    @Deprecated
    @TestCase(name = "Checks if birth number is already in use by the systems")
    public void verifyInOds(Harness harness) {
        harness.withIHub()
                .prepareRequestAsUfo(MWFHK8.class)
                .Rc("9308106489")//8111117399 / 8703234815
                .UcelDotazu("9")
                .BusinessRequestor("GEMCB")
                .AdresyOutputSysIDs("ICB|VIS|HYP|CMD")
                .IDZdrojovehoSystemuOUTPUT("ICB0")
                .MaximalniPocetZaznamu(50L)
                .PriznakBankovniTajemstvi("1")
                .PriznakRozsirenyVystup("1")
                .TypyOsobyFiltr("1|2|5")
                .AdresyOutputAktualniFlag("1")
                .send();

        NonClient client = harness.data().newNonClient();

        MWF109Response resp = harness.withIHub()
                .prepareRequestAsUfo(MWF109.class)
                .RodneCislo(client.birthNumber())
                .DatumNarozeni(TestUtils.dateFromString(client.birthDate(), "d.M.yyyy")) //YYYY-MM-DD
                .DatumExpiraceKontaktnichUdaju(DateUtils.getRawTodayDateIncrementedByDays(730))
                .PlatnostOPdo(client.idCardExpiredRaw())
                .DatumPotvrzeniPrijmu(client.dateOfIssueConfirmationOfReceipt())
                .DatumZalozeniCIFu(TestUtils.getTodayAsDate())
                .SerieACisloOP(client.idCardNumber())
                .OPStatVydal("52")
                .PrvniJmeno(client.firstName())
                .Prijmeni(client.lastName())
                .Co(client.residencyAddress().getOrientationNumber())
                .Cp(client.residencyAddress().getDescriptiveNumber())
                .KlasifikaceKlienta("0")
                .KodObchodnihoMista("86007040")
                .MistoNarozeni(client.placeOfBirth())
                .Psc(client.residencyAddress().getZip())
                .NazevZamestnavatele(client.employer().getName())
                .PlatnostKontaktnichUdaju("1")
                .CistyMesicniPrijem(30000d)
                .PocetVyzivovanychDeti(0L)
                .TelefonDomu(client.fixPhoneNumberHome())
                .TelefonZamestnani(client.employer().getPhoneNumber())
                .NejvyssiDosazeneVzdelani("4")
                .EkonomickySektor("44")
                .DruhPrijmuKlienta("1")
                .DruhBydleni("1")
                .PlatnostKontaktnichUdaju("1")
                .SocialneEkonomickaSkupina("1")
                .ZkraceneJmeno("ZkrJm")
                .TypKlienta("1")
                .Zeme("52")
                .ZemeNarozeni("52")
                .StatniPrislusnost("52")
                .send();

        Assertions.assertEquals(10, resp.Cif().length());
    }

}
