package org.jeecg.modules.adweb.marketing;

import org.jeecg.common.util.FastJsonUtil;
import org.jeecg.modules.adweb.common.util.DateUtil;
import org.jeecg.modules.adweb.marketing.googleads.service.GoogleAdsReportService;
import org.jeecg.modules.adweb.marketing.googleads.vo.*;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;

import java.util.Date;
import java.util.List;

/**
 * @author wfansh
 */
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("dev")
public class GoogleAdsTest {

    @Autowired private GoogleAdsReportService googleAdsReportService;

    private static final String siteCode = "231103s178kz";
    private static final Date start = DateUtil.parseDate("2024-11-01", DateUtil.DATE_FORMAT);
    private static final Date end = DateUtil.parseDate("2024-12-01", DateUtil.DATE_FORMAT);

    @Test
    @Disabled
    public void testGetCustomerStats() {
        CustomerStatsVO customerStatsVO = googleAdsReportService.getCustomerStats(siteCode);
        System.out.println(FastJsonUtil.toJSONString(customerStatsVO));
    }

    @Test
    @Disabled
    public void testGetDailyStats() {
        List<DailyStatsVO> dailyStatsVOs =
                googleAdsReportService.getDailyStats(siteCode, null, null);
        System.out.println(FastJsonUtil.toJSONString(dailyStatsVOs));
    }

    @Test
    public void testGetCampaignStats() {
        List<CampaignStatsVO> campaignStatsVOs =
                googleAdsReportService.getCampaignStats(siteCode, start, end);
        System.out.println(FastJsonUtil.toJSONString(campaignStatsVOs));
    }

    @Test
    @Disabled
    public void testGetKeywordStats() {
        List<KeywordStatsVO> keywordStatsVOs =
                googleAdsReportService.getKeywordStats(siteCode, null, null);
        System.out.println(FastJsonUtil.toJSONString(keywordStatsVOs));
    }

    @Test
    @Disabled
    public void testGetPlacementStats() {
        List<PlacementStatsVO> placementStatsVOs =
                googleAdsReportService.getPlacementStats(siteCode, null, null);
        System.out.println(FastJsonUtil.toJSONString(placementStatsVOs));
    }

    @Test
    public void testGetCountryStats() {
        List<CountryStatsVO> countryStatsStatsVOs =
                googleAdsReportService.getCountryStats(siteCode, null, null);
        System.out.println(FastJsonUtil.toJSONString(countryStatsStatsVOs));
    }
}
