package cz.moneta.test.regression.backoffice.ufooperations.regressionsbbo;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.ufo.operations.search.SearchBy;
import cz.moneta.test.dsl.util.credentials.Keys;
import cz.moneta.test.dsl.util.task.ufo.operations.OperationsTasks;
import cz.moneta.test.harness.annotations.Environment;
import cz.moneta.test.harness.annotations.JiraTestCase;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;
import cz.moneta.test.harness.support.auth.Credentials;
import cz.moneta.test.harness.support.auth.Key;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Disabled;

import static cz.moneta.test.dsl.util.task.ufo.cb.CommercialTasks.JIRA_COMMENT_STORE_KEY;

@TestScenario(name = "Vip Exchange Rate List")
public class VipExchangeRateList {

    String ICO = "05504465";

    @TestCase(name = "Vip Exchange Rate List", environments = {Environment.PPE})
    @JiraTestCase(id = "BOC-T8843")
    public void vipExchangeRateList(Harness harness, @Key(Keys.ufo.banka.banker) Credentials credentials) {

        OperationsTasks operationsTasksTasks = harness.tasks().ufo().operations();

        harness.withUfo()
                .openLoginPage()
                .then(operationsTasksTasks.login().withCredentials(credentials))
                .fillSearchInput(ICO)
                .searchBy(SearchBy.ICO)
                .onClientDetailsPage()
                .clickAccountList()
                .then(harness.tasks().ufo().operations().bankBackOfficeTasks().removeVipExchangeRateList())
                .clickHomePage()
                .fillSearchInput(ICO)
                .searchBy(SearchBy.ICO)
                .onClientDetailsPage()
                .clickAccountList()
                .then(harness.tasks().ufo().operations().bankBackOfficeTasks().setVipExchangeRateList())
                .clickHomePage()
                .fillSearchInput(ICO)
                .searchBy(SearchBy.ICO)
                .onClientDetailsPage()
                .assertRelationship("VIP Klient PO")
                .clickCorrespondence()
                .fillRc("")
                .clickSearchDocuments()
                .assertPrintName("Nastavení VIP Kurzovního lístku");
    }

    @AfterEach
    protected void teardown(Harness harness) {
        harness.store(JIRA_COMMENT_STORE_KEY,
                "\nUFO Session ID: " + harness.get("reports.tmfj.execution.commentufosessionid") +
                        "\nIČO: " + ICO);
    }
}