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

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_CLIENT_DEALS to WSO2 and assert response parameters")
public class ApiGetClientDeals {

    @TestCase(name = "Call API GET_CLIENT_DEALS to WSO2", environments = {TST1, PPE})
    public void postGetClientDeals(Harness harness) {
        harness.tasks().wso2().restRequest().prepareRequestFromCvm("investments.cluster/GET_CLIENT_DEALS/001", true,
                        "{\n" +
                                "\"CIF\":\"" + harness.getConfig("cvm.client.investment.cif") + "\",\n" +
                                "\"Produkt\": \"1\"\n" +
                                "}")
                .post()
                .andAssertStatus(200)
                .andAssertPresent("RS_DATA")
                .andAssertPresent("RS_DATA[0]")
                .andAssertPresent("RS_DATA[0].Status")
                .andAssertPresent("RS_DATA[0].ISIN")
                .andAssertPresent("RS_DATA[0].Cena");
    }
}
