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.data.account.AccountDetail;
import cz.moneta.test.dsl.util.task.wso2.ClientTasks;
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;

@TestScenario(name = "Creates account for FOP client.")
public class CreateFopAccount {

    @TestCase(name = "Creates account to given client.", environments = Environment.TST1)
    public void createFopAccount(Harness harness) {
        String cif = harness.getSystemOrConfigValue("cif");
        String name = harness.getSystemOrConfigValue("name");
        ClientTasks clientTasks = harness.tasks().wso2().client();
        Credentials credentials = AuthSupport.getCredentials(Keys.ufo.banka.banker, harness);
        AccountDetail accountDetail = new AccountDetail("1202003", "6");

        String accountNumber = clientTasks.createAccountAndGetAccountNumber(cif, name, accountDetail, credentials.getUsername());
        harness.log("Created account: " + accountNumber);

    }
}
