package org.jeecg.modules.adweb.dmp.dto.google.analytics.report;

import static org.jeecg.modules.adweb.dmp.dto.google.analytics.report.OrderByType.*;
import static org.jeecg.modules.adweb.dmp.dto.google.analytics.report.ReportConstant.*;

import lombok.Getter;

import java.util.Collections;
import java.util.List;

/**
 * @author wfansh
 */
@Getter
public enum ReportType {
    // V2 - adweb:country:chart
    ADWEB_COUNTRY_CHART(List.of(METRIC_TOTAL_USERS), List.of(DIMENSION_COUNTRY)),
    // v2 - adweb:sourceMedium:list
    ADWEB_SESSION_SOURCE_MEDIUM_VIEW(
            List.of(
                    METRIC_TOTAL_USERS,
                    METRIC_NEW_USERS,
                    METRIC_SESSIONS,
                    METRIC_BOUNCE_RATE,
                    METRIC_AVG_SESSION_DURATION,
                    METRIC_SCREEN_PAGE_VIEWS_PER_SESSION),
            List.of(DIMENSION_SESSION_SOURCE_MEDIUM)),
    // V2 - adweb:pagePath:list
    ADWEB_PAGE_PATH_VIEW(
            List.of(
                    METRIC_ENGAGEMENT_RATE,
                    METRIC_SCREEN_PAGE_VIEWS,
                    METRIC_USER_ENGAGEMENT_DURATION),
            List.of(DIMENSION_PAGE_PATH),
            METRIC_SCREEN_PAGE_VIEWS,
            METRICS,
            true),
    // V2 - adwebV2:customer:api, pageviews, uniqueuser, bounce, AvgSessionDuration,
    // adweb:active:user
    ADWEB_DATE_VIEW(
            List.of(
                    METRIC_TOTAL_USERS,
                    METRIC_ACTIVE_USERS,
                    METRIC_SCREEN_PAGE_VIEWS,
                    METRIC_BOUNCE_RATE,
                    METRIC_AVG_SESSION_DURATION),
            List.of(DIMENSION_DATE),
            DIMENSION_DATE,
            DIMENSIONS,
            false),
    // For flexible query.
    ADWEB_CUSTOM_REPORT(Collections.EMPTY_LIST, Collections.EMPTY_LIST);

    ReportType(List<String> defaultMetrics, List<String> defaultDimensions) {
        this.defaultMetrics = defaultMetrics;
        this.defaultDimensions = defaultDimensions;
        this.defaultOrderBy = null;
        this.defaultOrderByType = null;
        this.defaultOrderByDesc = false;
    }

    ReportType(
            List<String> defaultMetrics,
            List<String> defaultDimensions,
            String defaultOrderBy,
            OrderByType defaultOrderByType,
            boolean defaultOrderByDesc) {
        this.defaultMetrics = defaultMetrics;
        this.defaultDimensions = defaultDimensions;
        this.defaultOrderBy = defaultOrderBy;
        this.defaultOrderByType = defaultOrderByType;
        this.defaultOrderByDesc = defaultOrderByDesc;
    }

    private final List<String> defaultMetrics;
    private final List<String> defaultDimensions;
    private final String defaultOrderBy;
    private final OrderByType defaultOrderByType;
    private final Boolean defaultOrderByDesc;
}
