package cz.moneta.test.dataprepare.ufo.cb;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.util.credentials.Keys;
import cz.moneta.test.dsl.util.task.dataprepare.DataPrepareTasks;
import cz.moneta.test.harness.annotations.Environment;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;
import cz.moneta.test.harness.support.auth.AuthSupport;
import cz.moneta.test.harness.support.auth.Credentials;

import java.util.ArrayList;

@TestScenario(name = "Creates given number of clients by calling sequence of MWF.")
public class CreateNewFopClients {

    @TestCase(name = "Creates given number of clients by calling sequence of MWF.", environments = Environment.TST1)
    public void createClients(Harness harness) {
        DataPrepareTasks dataPrepareTasks = harness.tasks().dataPrepareTasks();
        Credentials credentials = AuthSupport.getCredentials(Keys.ufo.banka.banker, harness);

        int count = Integer.parseInt(harness.getConfig("count", "1"));
        ArrayList<String> clients = new ArrayList<>();
        for (int i = 0; i < count; i++) {
            String client = dataPrepareTasks.createNewFopCustomerViaWso2AndGetCif(credentials.getUsername());
            clients.add(client);
        }
        harness.log("Created clients CIF:");
        for (String client : clients) {
            harness.log(client);
        }
    }

}
