import type { IFont, IStatisticDefinition } from "../../spec/rest-js-types.js";

export const LimitBehavior: {
    readonly Reject: "reject";
    readonly RenderUpToTheLimit: "renderUpToTheLimit";
};

export type LimitBehavior = (typeof LimitBehavior)[keyof typeof LimitBehavior];

export interface ChartElementLimit {
  behaviorAfterLimit?: LimitBehavior;
  maxCategoryCount?: number;
  maxBarChartSeriesCount?: number;
  maxBarUniqueSeriesCountTotal?: number;
  maxBarTwoSeriesCountPerSeries?: number;
  maxBarTwoSeriesCountTotal?: number;
  maxBarThreePlusSeriesCountPerSeries?: number;
  maxBarThreePlusSeriesCountTotal?: number;
  maxScatterPointsBeforeAggregation?: number;
  maxScatterPointsAfterAggregation?: number;
  maxLineChartSeriesCount?: number;
  maxLineUniqueSeriesCountTotal?: number;
  maxLineTwoSeriesCountPerSeries?: number;
  maxLineTwoSeriesCountTotal?: number;
  maxLineThreePlusSeriesCountPerSeries?: number;
  maxLineThreePlusSeriesCountTotal?: number;
  maxPieChartSliceCountTotal?: number;
  maxGaugeByFeaturesLimit?: number;
  maxBoxPlotSeriesCount?: number;
  maxBoxUniqueSeriesCountTotal?: number;
  maxBoxTwoSeriesCountTotal?: number;
  maxBoxTwoSeriesCountPerSeries?: number;
  maxBoxThreePlusSeriesCountTotal?: number;
  maxBoxThreePlusSeriesCountPerSeries?: number;
  maxBoxPlotOutlierLimit?: number;
  maxHeatChartCellLimit?: number;
}

export interface ChartElementTechnicalLimit {
  maxScatterCellsPerQuery: number;
  maxScatterCellsPerQueryForStandard: number;
  maxElementsPerSelectionQuery: number;
  maxOIDsPerSelectionQuery: number;
  maxOperandsPerWhereClause: number;
}

/** @internal */
export interface QueryDefaults {
  maxRecordCountFactor: number;
  maxParallelRequests: number;
  maxRecords: number;
  outStatistics: Readonly<IStatisticDefinition>;
  uniqueIdsName: number | string;
  orderByJSAPIDelimiter: string;
  heatChartLowerBoundaryAlias: string;
  heatChartUpperBoundaryAlias: string;
}

/** @internal */
export interface ChartTextProps {
  text: string;
  visible: boolean;
  font: IFont;
  type?: TextElements;
}

/** @internal */
export const TextElements: {
    readonly AxisLabels: "axisLabels";
    readonly GuideLabel: "guideLabel";
    readonly AxisTitle: "axisTitle";
    readonly ChartTitle: "chartTitle";
    readonly ChartSubtitle: "chartSubtitle";
    readonly DataLabels: "dataLabels";
    readonly LegendTitle: "legendTitle";
    readonly LegendText: "legendText";
    readonly DescriptionText: "descriptionText";
};

/** @internal */
export type TextElements = (typeof TextElements)[keyof typeof TextElements];