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

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

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

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

    public static final String GET_PRODINST_DATA_PATH = "data.cluster/GET_PRODINST_DATA/001";

    @TestCase(name = "Call API GET_PRODINST_DATA to WSO2", environments = {TST1, PPE})
    public void postGetProdinstData(Harness harness) {
        harness.tasks().wso2().restRequest().prepareRequestFromCvm(GET_PRODINST_DATA_PATH, true,
                        "{\n" +
                                "  \"SRC_SYS_ID\": \"SBU03\",\n" +
                                "  \"RS_2\": [\n" +
                                "    {}\n" +
                                "  ],\n" +
                                "  \"RS_1\": [\n" +
                                "    {\n" +
                                "      \"UNI_PT_KEY_IN\": " + harness.getConfig("cvm.client.uniptkey") + "\n" +
                                "    }\n" +
                                "  ],\n" +
                                "  \"PURPOSE\": \"2\",\n" +
                                "  \"BUSINESS\": \"GEMCB\",\n" +
                                "  \"BANK_SECRET\": \"0\"\n" +
                                "}")
                .post()
                .andAssertStatus(200)
                .andAssertPresent("RS_4")
                .andAssertPresent("RS_5")
                .andAssertPresent("RS_3");
    }
}
