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


import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;
import cz.moneta.test.harness.support.rest.RawRestRequest;

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

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

    @TestCase(name = "Call API MWFAE1 to WSO2", environments = {TST1, PPE})
    public void postMWFAE1(Harness harness) {
        getResponseOfCallMWFAE1(harness);
    }

    public RawRestRequest.Response getResponseOfCallMWFAE1(Harness harness) {
        return harness.tasks().wso2().restRequest().prepareRequestFromCvm("integration.gov/MWFAE1/001", true,
                "{\n" +
                        "    \"Data\": [\n" +
                        "        {\n" +
                        "            \"RS_NAME\": \"string\",\n" +
                        "            \"RS_VALUE\": \"string\"\n" +
                        "        }\n" +
                        "    ],\n" +
                        "    \"InteractiveContractId\": null,\n" +
                        "    \"InteractiveContractName\": null,\n" +
                        "    \"InteractiveHolderRole\": null,\n" +
                        "    \"InteractiveHolderUserName\": null,\n" +
                        "    \"InteractiveState\": null,\n" +
                        "    \"IsInteractive\": null,\n" +
                        "    \"directPrintEnable\": null,\n" +
                        "    \"docType\": \"PDF\",\n" +
                        "    \"duplexMode\": null,\n" +
                        "    \"numberOfCopies\": null,\n" +
                        "    \"printDoc\": null,\n" +
                        "    \"printerAddress\": null,\n" +
                        "    \"printerPort\": null,\n" +
                        "    \"rptData\": \"<?xml version=\\\"1.0\\\" " +
                        "encoding=\\\"windows-1250\\\"?><RptData><WELCOME_WUSTENROT_MONETA><Record><JMENO_KLIENT>Klimtová</JMENO_KLIENT" +
                        "><JMENO_PORADCE>Milan Novák</JMENO_PORADCE><TEL_PORADCE>777777777</TEL_PORADCE><EMAIL_PORADCE>Milan" +
                        ".Novak@wustenrot.cz</EMAIL_PORADCE><QR>https://moneta.page.link/?apn=cz.moneta.smartbanka&isi=1122443334&ibi=cz" +
                        ".moneta.smartbanka&si=https://www.moneta.cz/documents/cz/wustenrot/page.png&link=https://smartbanka.moneta" +
                        ".cz/?user_lead%3Df9316c185d1a4cc1857ae3d97261ba3f7d907ae89a99432aad4bd5037734e3d1</QR></Record" +
                        "></WELCOME_WUSTENROT_MONETA></RptData>\",\n" +
                        "    \"rptName\": \"vcs://Runtime/Non-UFO/WPS/WELCOME_WUSTENROT_MONETA.wfd\"\n" +
                        "}")
                .post()
                .andAssertStatus(200)
                .andAssertPresent("result")
                .andAssertPresent("numberOfPages")
                .andAssertPresent("InteractiveTicketId")
                .andAssertPresent("documentURL")
                .andAssertPresent("docGuid");
    }
}
