package cz.moneta.test.regression.cvm.api.cvm;

import com.fasterxml.jackson.databind.JsonNode;
import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;

import java.util.UUID;

import static cz.moneta.test.harness.annotations.Environment.PPE;
import static cz.moneta.test.harness.annotations.Environment.TST1;

@TestScenario(name = "Call API SAS_RTDM_Web_Exp_AppCreated_CC to WSO2 and assert response parameters")
public class ApiSasRtdmWebExpAppCreatedCc {

    @TestCase(name = "Call API SAS_RTDM_Web_Exp_AppCreated_CC to WSO2", environments = {TST1, PPE})
    public void postSasRtdmWebExpAppCreatedCc(Harness harness) {
        JsonNode outputs = harness.tasks().wso2().restRequest().prepareRequestFromCvm(
                "cvm.cluster/SAS_RTDM_Web_Exp_AppCreated_CC/1.0.0", false,
                "{\n" +
                        "    \"clientTimeZone\": \"Europe/Prague\",\n" +
                        "    \"correlationId\": \"" + UUID.randomUUID() + "\",\n" +
                        "    \"version\": 1,\n" +
                        "    \"inputs\": {\n" +
                        "        \"PROCESS_CACHECODE\": \"" + UUID.randomUUID() + "\",\n" +
                        "        \"PROCESS_LASTTRACKER\": \"process.tracker.financeDetails\",\n" +
                        "        \"PROCESS_CLIENTCHECKWFID\": \"CLCH_0000123456\",\n" +
                        "        \"PROCESS_UTMPARAMS\": \"Kampan 1\",\n" +
                        "        \"CLIENT_HASHEDCIF\": \"3214521\",\n" +
                        "        \"PRODUCT_EXPRES_LOANAMOUNT\": 50000,\n" +
                        "        \"PRODUCT_EXPRES_TERM\": 24,\n" +
                        "        \"PRODUCT_EXPRES_RPSN\": 5,\n" +
                        "        \"CLIENT_FIRSTNAME\": \"Aleš\",\n" +
                        "        \"CLIENT_LASTNAME\": \"Zlámal\",\n" +
                        "        \"CLIENT_MOBILEPHONENUMBER\": \"420725810842\",\n" +
                        "        \"CLIENT_EMAIL\": \"ales.zlamal@neexistujicidomana.com\",\n" +
                        "        \"CLIENT_CONSENTTOOFFERMARKETING\": true,\n" +
                        "        \"CLIENT_PERMANENTADDRESS_STREET\": \"Novotného\",\n" +
                        "        \"CLIENT_PERMANENTADDRESS_LANDREGISTRYNUMBER\": 2,\n" +
                        "        \"CLIENT_PERMANENTADDRESS_HOUSENUMBER\": \"3a\",\n" +
                        "        \"CLIENT_PERMANENTADDRESS_CITY\": \"Praha\",\n" +
                        "        \"CLIENT_PERMANENTADDRESS_ZIP\": 12000,\n" +
                        "        \"CLIENT_PERMANENTADDRESS_STAYONADDRESSSINCE\": \"2017-04-10 14:16:14\",\n" +
                        "        \"CLIENT_CONTACTADDRESS_STREET\": \"Novotného\",\n" +
                        "        \"CLIENT_CONTACTADDRESS_LANDREGISTRYNUMBER\": 2,\n" +
                        "        \"CLIENT_CONTACTADDRESS_HOUSENUMBER\": \"3a\",\n" +
                        "        \"CLIENT_CONTACTADDRESS_CITY\": \"Praha\",\n" +
                        "        \"CLIENT_CONTACTADDRESS_ZIP\": 12000,\n" +
                        "        \"CLIENT_IDENTITYCARD_NUMBER\": 6207066536,\n" +
                        "        \"CLIENT_IDENTITYCARD_EXPIRATION\": \"2020-06-18 14:16:14\",\n" +
                        "        \"CLIENT_BIRTHNUMBER\": \"5487456987\",\n" +
                        "        \"CLIENT_MARITALSTATUS\": \"2\",\n" +
                        "        \"CLIENT_NATIONALITY\": \"52\",\n" +
                        "        \"CLIENT_BIRTHPLACE\": \"Praha\",\n" +
                        "        \"CLIENT_COUNTRYOFBIRTH\": \"52\",\n" +
                        "        \"CLIENT_EMPLOYMENT_EMPLOYMENTTYPECODE\": \"2\",\n" +
                        "        \"CLIENT_EMPLOYMENT_EMPLOYERNAME\": \"Moneta a.s.\",\n" +
                        "        \"CLIENT_EMPLOYMENT_EMPLOYERID\": \"25672720\",\n" +
                        "        \"CLIENT_EMPLOYMENT_EMPLOYEDFROM\": \"2016-06-18 14:16:14\",\n" +
                        "        \"CLIENT_EMPLOYMENT_EMPLOYEDTO\": \"\",\n" +
                        "        \"CLIENT_EMPLOYMENT_TRIALPERIOD\": false,\n" +
                        "        \"CLIENT_EMPLOYMENT_NOTICEPERIOD\": false,\n" +
                        "        \"CLIENT_NET3MONTHINCOME\": 149820,\n" +
                        "        \"CLIENT_NET3MONTHHOUSEHOLDINCOME\": 281452,\n" +
                        "        \"CLIENT_INSTALLMENTSOUTSIDEMONETA\": 5000,\n" +
                        "        \"CLIENT_OTHERCOSTOFLIVING\": 25000,\n" +
                        "        \"CLIENT_NUMBEROFDEPENDENTS\": 2,\n" +
                        "        \"CLIENT_EDUCATION\": \"4\",\n" +
                        "        \"CLIENT_LIVINGTYPE\": \"3\",\n" +
                        "        \"CLIENT_CIF\": \"362173978\",\n" +
                        "        \"CLIENT_MARKETINGCLIENTTYPE\": \"3\",\n" +
                        "        \"CLIENT_EMPLOYMENT_EMPLOYEEFLAG\": true,\n" +
                        "        \"PRODUCT_EXISTINGINTERNETBANK\": true,\n" +
                        "        \"PRODUCT_PRODPACKAGEKEY\": 12345698,\n" +
                        "        \"PRODUCT_APPKEYEXPRES\": 123456852,\n" +
                        "        \"PRODUCT_APPKEYCA\": 3216547,\n" +
                        "        \"PRODUCT_APPKEYDC\": 3214521,\n" +
                        "        \"PRODUCT_APPKEYIB\": 12345657,\n" +
                        "        \"PRODUCT_INSTPTKEYEXPRES\": 12358965,\n" +
                        "        \"CLIENT_UNIKEY\": 148881,\n" +
                        "        \"PRODUCT_COMPLETABLEIB\": true,\n" +
                        "        \"PRODUCT_INSURANCEREQUESTED\": true,\n" +
                        "        \"CLIENT_REALNET3MONTHINCOME\": 148881,\n" +
                        "        \"PRODUCT_APPKEYCIF\": 12365455\n" +
                        "    }\n" +
                        "}")
                .post()
                .andAssertStatus(201)
                .extract("outputs");

        harness.tasks().cvm().cvmWso2().assertResponseOutputs(outputs);
    }
}