package io.delphi.qa.auto.awsmfrw.tests.api.steps.ads;

import io.delphi.qa.auto.awsmfrw.common_baby.delphi.aws.EnAwsSecrets;
import io.delphi.qa.auto.awsmfrw.models.db.sql.pg.EnDelphiDbResourceList;
import io.delphi.qa.auto.awsmfrw.tests.api.BsApiTest;
import io.qameta.allure.Step;

import java.util.List;
import java.util.Map;

public abstract class AdsCampaignsSteps extends BsApiTest {

    @Step("Get data from API db")
    protected List<Map<String, String>> getCampaignsBudgetsValues() {
                    return delphi
                                .db()
                                .postgres(fetchAwsSecret(EnAwsSecrets.DELPHI_API_DB_PARAMS))
                                .awsmQueryNew(String.format(
                                        "select\n"
                                                + "\tdistinct\n"
                                                + "\t\t*\n"
                                                + "from\n"
                                                + "\t%1$s%2$s\n"
                                                + "where updated_at is not null and budget is not null limit 10",
                                        EnDelphiDbResourceList.ADS_AD_SET_CAMPAIGN_BUDGET.resourceLocator(),
                                        EnDelphiDbResourceList.ADS_AD_SET_CAMPAIGN_BUDGET.resourceName(),
                                        EnDelphiDbResourceList.ADS_AD_SET_CAMPAIGN_BUDGET.resourceValue()));
    }

}
