/**
 * Google Analytics Node - Version 2
 * Discriminator: resource=report, operation=get
 */


interface Credentials {
  googleAnalyticsOAuth2: CredentialReference;
}

/** Return the analytics data */
export type GoogleAnalyticsV2ReportGetParams = {
  resource: 'report';
  operation: 'get';
/**
 * Google Analytics 4 is the latest version. Universal Analytics is an older version that is not fully functional after the end of June 2023.
 * @default ga4
 */
    propertyType?: 'ga4' | 'universal';
/**
 * The Property of Google Analytics
 * @hint If this doesn't work, try changing the 'Property Type' field above
 * @displayOptions.show { propertyType: ["ga4"] }
 * @default {"mode":"list","value":""}
 */
    propertyId?: { __rl: true; mode: 'list' | 'url' | 'id'; value: string; cachedResultName?: string };
/**
 * Date Range
 * @displayOptions.show { propertyType: ["ga4"] }
 * @default last7days
 */
    dateRange?: 'last7days' | 'last30days' | 'today' | 'yesterday' | 'lastCalendarWeek' | 'lastCalendarMonth' | 'custom' | Expression<string>;
/**
 * Start
 * @displayOptions.show { dateRange: ["custom"], propertyType: ["ga4"] }
 * @default 2026-04-02T00:00:00.000+00:00
 */
    startDate?: string | Expression<string>;
/**
 * End
 * @displayOptions.show { dateRange: ["custom"], propertyType: ["ga4"] }
 * @default 2026-04-09T00:00:00.000+00:00
 */
    endDate?: string | Expression<string>;
/**
 * The quantitative measurements of a report. For example, the metric eventCount is the total number of events. Requests are allowed up to 10 metrics.
 * @displayOptions.show { propertyType: ["ga4"] }
 * @default {"metricValues":[{"listName":"totalUsers"}]}
 */
    metricsGA4?: {
        /** Values
     */
    metricValues?: Array<{
      /** Metric
       * @default totalUsers
       */
      listName?: 'active1DayUsers' | 'active28DayUsers' | 'active7DayUsers' | 'checkouts' | 'eventCount' | 'screenPageViews' | 'userEngagementDuration' | 'sessions' | 'sessionsPerUser' | 'totalUsers' | 'other' | 'custom' | Expression<string>;
      /** The name of the metric. Choose from the list, or specify an ID using an &lt;a href="https://docs.n8n.io/code/expressions/"&gt;expression&lt;/a&gt;.
       * @hint If expression is specified, name can be any string that you would like
       * @displayOptions.show { listName: ["other"] }
       * @default totalUsers
       */
      name?: string | Expression<string>;
      /** Name
       * @displayOptions.show { listName: ["custom"] }
       * @default custom_metric
       */
      name?: string | Expression<string> | PlaceholderValue;
      /** A mathematical expression for derived metrics. For example, the metric Event count per user is eventCount/totalUsers.
       * @displayOptions.show { listName: ["custom"] }
       */
      expression?: string | Expression<string> | PlaceholderValue;
      /** Whether a metric is invisible in the report response. If a metric is invisible, the metric will not produce a column in the response, but can be used in metricFilter, orderBys, or a metric expression.
       * @displayOptions.show { listName: ["custom"] }
       * @default false
       */
      invisible?: boolean | Expression<boolean>;
    }>;
  };
/**
 * Dimensions are attributes of your data. For example, the dimension city indicates the city from which an event originates. Dimension values in report responses are strings; for example, the city could be "Paris" or "New York". Requests are allowed up to 9 dimensions.
 * @displayOptions.show { propertyType: ["ga4"] }
 * @default {"dimensionValues":[{"listName":"date"}]}
 */
    dimensionsGA4?: {
        /** Values
     */
    dimensionValues?: Array<{
      /** Dimension
       * @default date
       */
      listName?: 'browser' | 'campaignName' | 'city' | 'country' | 'date' | 'deviceCategory' | 'itemName' | 'language' | 'pageLocation' | 'sourceMedium' | 'other' | Expression<string>;
      /** The name of the dimension. Choose from the list, or specify an ID using an &lt;a href="https://docs.n8n.io/code/expressions/"&gt;expression&lt;/a&gt;.
       * @displayOptions.show { listName: ["other"] }
       * @default date
       */
      name?: string | Expression<string>;
    }>;
  };
/**
 * Whether to return all results or only up to a given limit
 * @displayOptions.show { propertyType: ["ga4"] }
 * @default false
 */
    returnAll?: boolean | Expression<boolean>;
/**
 * Max number of results to return
 * @displayOptions.show { propertyType: ["ga4"], returnAll: [false] }
 * @default 50
 */
    limit?: number | Expression<number>;
/**
 * Whether to return a simplified version of the response instead of the raw data
 * @displayOptions.show { propertyType: ["ga4"] }
 * @default true
 */
    simple?: boolean | Expression<boolean>;
/**
 * Additional Fields
 * @displayOptions.show { propertyType: ["ga4"] }
 * @default {}
 */
    additionalFields?: {
    /** A currency code in ISO4217 format, such as "AED", "USD", "JPY". If the field is empty, the report uses the property's default currency.
     */
    currencyCode?: string | Expression<string> | PlaceholderValue;
    /** Dimensions Filters
     * @default {}
     */
    dimensionFiltersUI?: {
        /** Filter Expressions
     */
    filterExpressions?: {
      /** Filter Expression Type
       * @default andGroup
       */
      filterExpressionType?: 'andGroup' | 'orGroup' | Expression<string>;
      /** Expression
       * @default {}
       */
      expression?: {
        /** String Filter
     */
    stringFilter?: Array<{
      /** Dimension
       * @default date
       */
      listName?: 'browser' | 'campaignName' | 'city' | 'country' | 'date' | 'deviceCategory' | 'itemName' | 'language' | 'pageLocation' | 'sourceMedium' | 'other' | Expression<string>;
      /** The name of the dimension. Choose from the list, or specify an ID using an &lt;a href="https://docs.n8n.io/code/expressions/"&gt;expression&lt;/a&gt;.
       * @displayOptions.show { listName: ["other"] }
       * @default date
       */
      name?: string | Expression<string>;
      /** Value
       */
      value?: string | Expression<string> | PlaceholderValue;
      /** Case Sensitive
       * @default true
       */
      caseSensitive?: boolean | Expression<boolean>;
      /** Match Type
       * @default EXACT
       */
      matchType?: 'BEGINS_WITH' | 'CONTAINS' | 'ENDS_WITH' | 'EXACT' | 'FULL_REGEXP' | 'PARTIAL_REGEXP' | Expression<string>;
    }>;
        /** In List Filter
     */
    inListFilter?: Array<{
      /** Dimension
       * @default date
       */
      listName?: 'browser' | 'campaignName' | 'city' | 'country' | 'date' | 'deviceCategory' | 'itemName' | 'language' | 'pageLocation' | 'sourceMedium' | 'other' | Expression<string>;
      /** The name of the dimension. Choose from the list, or specify an ID using an &lt;a href="https://docs.n8n.io/code/expressions/"&gt;expression&lt;/a&gt;.
       * @displayOptions.show { listName: ["other"] }
       * @default date
       */
      name?: string | Expression<string>;
      /** Values
       * @hint Comma separated list of values. Must be non-empty.
       */
      values?: string | Expression<string> | PlaceholderValue;
      /** Case Sensitive
       * @default true
       */
      caseSensitive?: boolean | Expression<boolean>;
    }>;
        /** Numeric Filter
     */
    numericFilter?: Array<{
      /** Dimension
       * @default date
       */
      listName?: 'browser' | 'campaignName' | 'city' | 'country' | 'date' | 'deviceCategory' | 'itemName' | 'language' | 'pageLocation' | 'sourceMedium' | 'other' | Expression<string>;
      /** The name of the dimension. Choose from the list, or specify an ID using an &lt;a href="https://docs.n8n.io/code/expressions/"&gt;expression&lt;/a&gt;.
       * @displayOptions.show { listName: ["other"] }
       * @default date
       */
      name?: string | Expression<string>;
      /** Value Type
       * @default doubleValue
       */
      valueType?: 'doubleValue' | 'int64Value' | Expression<string>;
      /** Value
       */
      value?: string | Expression<string> | PlaceholderValue;
      /** Operation
       * @default EQUAL
       */
      operation?: 'EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL';
    }>;
  };
    };
  };
    /** Metric Aggregation
     * @displayOptions.show { /simple: [false] }
     * @default []
     */
    metricAggregations?: Array<'MAXIMUM' | 'MINIMUM' | 'TOTAL'>;
    /** Metrics Filters
     * @default {}
     */
    metricsFiltersUI?: {
        /** Filter Expressions
     */
    filterExpressions?: {
      /** Filter Expression Type
       * @default andGroup
       */
      filterExpressionType?: 'andGroup' | 'orGroup' | Expression<string>;
      /** Expression
       * @default {}
       */
      expression?: {
        /** Between Filter
     */
    betweenFilter?: Array<{
      /** Metric
       * @default totalUsers
       */
      listName?: 'active1DayUsers' | 'active28DayUsers' | 'active7DayUsers' | 'checkouts' | 'eventCount' | 'screenPageViews' | 'userEngagementDuration' | 'sessions' | 'sessionsPerUser' | 'totalUsers' | 'other' | 'custom' | Expression<string>;
      /** The name of the metric. Choose from the list, or specify an ID using an &lt;a href="https://docs.n8n.io/code/expressions/"&gt;expression&lt;/a&gt;.
       * @hint If expression is specified, name can be any string that you would like
       * @displayOptions.show { listName: ["other"] }
       * @default totalUsers
       */
      name?: string | Expression<string>;
      /** Name
       * @displayOptions.show { listName: ["custom"] }
       * @default custom_metric
       */
      name?: string | Expression<string> | PlaceholderValue;
      /** Value Type
       * @default doubleValue
       */
      valueType?: 'doubleValue' | 'int64Value' | Expression<string>;
      /** From Value
       */
      fromValue?: string | Expression<string> | PlaceholderValue;
      /** To Value
       */
      toValue?: string | Expression<string> | PlaceholderValue;
    }>;
        /** Numeric Filter
     */
    numericFilter?: Array<{
      /** Metric
       * @default totalUsers
       */
      listName?: 'active1DayUsers' | 'active28DayUsers' | 'active7DayUsers' | 'checkouts' | 'eventCount' | 'screenPageViews' | 'userEngagementDuration' | 'sessions' | 'sessionsPerUser' | 'totalUsers' | 'other' | 'custom' | Expression<string>;
      /** The name of the metric. Choose from the list, or specify an ID using an &lt;a href="https://docs.n8n.io/code/expressions/"&gt;expression&lt;/a&gt;.
       * @hint If expression is specified, name can be any string that you would like
       * @displayOptions.show { listName: ["other"] }
       * @default totalUsers
       */
      name?: string | Expression<string>;
      /** Name
       * @displayOptions.show { listName: ["custom"] }
       * @default custom_metric
       */
      name?: string | Expression<string> | PlaceholderValue;
      /** Value Type
       * @default doubleValue
       */
      valueType?: 'doubleValue' | 'int64Value' | Expression<string>;
      /** Value
       */
      value?: string | Expression<string> | PlaceholderValue;
      /** Operation
       * @default EQUAL
       */
      operation?: 'EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL';
    }>;
  };
    };
  };
    /** Whether false or unspecified, each row with all metrics equal to 0 will not be returned. If true, these rows will be returned if they are not separately removed by a filter.
     * @default false
     */
    keepEmptyRows?: boolean | Expression<boolean>;
    /** Specifies how rows are ordered in the response
     * @default {}
     */
    orderByUI?: {
        /** Metric Order By
     */
    metricOrderBy?: Array<{
      /** Whether true, sorts by descending order
       * @default false
       */
      desc?: boolean | Expression<boolean>;
      /** Sorts by metric values. Choose from the list, or specify an ID using an &lt;a href="https://docs.n8n.io/code/expressions/"&gt;expression&lt;/a&gt;.
       */
      metricName?: string | Expression<string>;
    }>;
        /** Dimmension Order By
     */
    dimmensionOrderBy?: Array<{
      /** Whether true, sorts by descending order
       * @default false
       */
      desc?: boolean | Expression<boolean>;
      /** Sorts by metric values. Choose from the list, or specify an ID using an &lt;a href="https://docs.n8n.io/code/expressions/"&gt;expression&lt;/a&gt;.
       */
      dimensionName?: string | Expression<string>;
      /** Order Type
       * @default ORDER_TYPE_UNSPECIFIED
       */
      orderType?: 'ALPHANUMERIC' | 'CASE_INSENSITIVE_ALPHANUMERIC' | 'NUMERIC' | 'ORDER_TYPE_UNSPECIFIED' | Expression<string>;
    }>;
  };
    /** Whether to return the current state of this Analytics Property's quota. Quota is returned in PropertyQuota.
     * @displayOptions.show { /simple: [false] }
     * @default false
     */
    returnPropertyQuota?: boolean | Expression<boolean>;
  };
/**
 * The View of Google Analytics
 * @hint If this doesn't work, try changing the 'Property Type' field above
 * @displayOptions.show { propertyType: ["universal"] }
 * @default {"mode":"list","value":""}
 */
    viewId?: { __rl: true; mode: 'list' | 'url' | 'id'; value: string; cachedResultName?: string };
/**
 * Metrics in the request
 * @displayOptions.show { propertyType: ["universal"] }
 * @default {"metricValues":[{"listName":"ga:users"}]}
 */
    metricsUA?: {
        /** Metric
     */
    metricValues?: Array<{
      /** Metric
       * @default ga:users
       */
      listName?: 'ga:productCheckouts' | 'ga:totalEvents' | 'ga:pageviews' | 'ga:sessionDuration' | 'ga:sessions' | 'ga:sessionsPerUser' | 'ga:users' | 'other' | 'custom' | Expression<string>;
      /** The name of the metric. Choose from the list, or specify an ID using an &lt;a href="https://docs.n8n.io/code/expressions/"&gt;expression&lt;/a&gt;.
       * @hint If expression is specified, name can be any string that you would like
       * @displayOptions.show { listName: ["other"] }
       * @default ga:users
       */
      name?: string | Expression<string>;
      /** Name
       * @displayOptions.show { listName: ["custom"] }
       * @default custom_metric
       */
      name?: string | Expression<string> | PlaceholderValue;
      /** Learn more about Google Analytics &lt;a href="https://developers.google.com/analytics/devguides/reporting/core/v4/rest/v4/reports/batchGet#Metric"&gt;metric expressions&lt;/a&gt;
       * @displayOptions.show { listName: ["custom"] }
       */
      expression?: string | Expression<string> | PlaceholderValue;
      /** Specifies how the metric expression should be formatted
       * @displayOptions.show { listName: ["custom"] }
       * @default INTEGER
       */
      formattingType?: 'CURRENCY' | 'FLOAT' | 'INTEGER' | 'PERCENT' | 'TIME' | Expression<string>;
    }>;
  };
/**
 * Dimensions are attributes of your data. For example, the dimension ga:city indicates the city, for example, "Paris" or "New York", from which a session originates.
 * @displayOptions.show { propertyType: ["universal"] }
 * @default {"dimensionValues":[{"listName":"ga:date"}]}
 */
    dimensionsUA?: {
        /** Values
     */
    dimensionValues?: Array<{
      /** Dimension
       * @default ga:date
       */
      listName?: 'ga:browser' | 'ga:campaign' | 'ga:city' | 'ga:country' | 'ga:date' | 'ga:deviceCategory' | 'ga:productName' | 'ga:language' | 'ga:pagePath' | 'ga:sourceMedium' | 'other' | Expression<string>;
      /** Name of the dimension to fetch, for example ga:browser. Choose from the list, or specify an ID using an &lt;a href="https://docs.n8n.io/code/expressions/"&gt;expression&lt;/a&gt;.
       * @displayOptions.show { listName: ["other"] }
       * @default ga:date
       */
      name?: string | Expression<string>;
    }>;
  };
};

export type GoogleAnalyticsV2ReportGetOutput = {
  date?: string;
  dimensionHeaders?: Array<{
    name?: string;
  }>;
  kind?: string;
  metadata?: {
    currencyCode?: string;
    timeZone?: string;
  };
  metricHeaders?: Array<{
    name?: string;
    type?: string;
  }>;
  sessions?: string;
  totalUsers?: string;
};

export type GoogleAnalyticsV2ReportGetNode = {
  type: 'n8n-nodes-base.googleAnalytics';
  version: 2;
  credentials?: Credentials;
  config: NodeConfig<GoogleAnalyticsV2ReportGetParams>;
  output?: Items<GoogleAnalyticsV2ReportGetOutput>;
};