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

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 java.time.LocalDate;
import java.time.format.DateTimeFormatter;

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

@Disabled
@TestScenario(name = "Transfer account to 530")
public class TransferAccountTo530 {
    String accountNumber = "207955816";

    @TestCase(name = "Transfer account to 530", environments = {Environment.PPE})
    @JiraTestCase(id = "BOC-T8581")
    public void transferAccountTo530(Harness harness, @Key(Keys.ufo.banka.banker) Credentials credentials) {

        OperationsTasks operationsTasksTasks = harness.tasks().ufo().operations();
        harness.withUfo()
                .openLoginPage()
                .then(operationsTasksTasks.login().withCredentialsAndSelectFirstOM(credentials))
                .fillSearchInput(accountNumber)
                .searchBy(SearchBy.ACCOUNT_NUMBER)
                .onClientDetailsPage()
                .transferTo530()
                .fillDate(LocalDate.now().plusDays(1).format(DateTimeFormatter.ofPattern("dd.MM.yyyy")))
                .clickOnCashless()
                .fillAccountNumber("2727")
                .fillBankCode("2700")
                .clickOk();
    }

    @AfterEach
    protected void teardown(Harness harness) {
        harness.store(JIRA_COMMENT_STORE_KEY,
                "\nUFO Session ID: " + harness.get("reports.tmfj.execution.commentufosessionid") +
                        "\nČíslo účtu: " + accountNumber);
    }
}