import { XAxisInputProcessor } from './x-axis-input-processor';
/** The `HorizontalYAxisInputProcessor` class is a TypeScript class that generates y-axis options for a line chart based on input data and previous layout results. */
export class HorizontalYAxisInputProcessor extends XAxisInputProcessor {
  /**
   * This function generates horizontal y-axis options for a line chart based on input data and previous layout results.
   *
   * @param {ChartOptions<LineChartDataType>} input - An object containing chart options, including the data source, x-axis options, and
   * container element.
   * @param {LayoutProcessResultType} [previousOutput] - The optional output from the previous layout
   * process. It is of type LayoutProcessResultType and contains information about the innerWidth and
   * innerHeight of the chart container.
   * @returns {ChartExtend<AxisScale<AxisDomain>>} a ChartExtend object that contains the options for the X-axis of a line chart, including
   * the scale generated by the scaleGenerator and the axis options generated by the axisGenerator.
   */
  process(input, previousOutput) {
    const { dataSource, xAxis, container } = input;
    const { innerWidth, innerHeight } = previousOutput;
    const xAxisType = (xAxis === null || xAxis === void 0 ? void 0 : xAxis.type) || 'value';
    const scale = this.getScale(dataSource, innerHeight, xAxisType, container.tagName === 'VEGA-LINE-CHART' ? 1 : 0.1, xAxis === null || xAxis === void 0 ? void 0 : xAxis.sorter);
    return {
      start: { x: 0, y: 0 },
      end: { x: 0, y: innerHeight },
      tickSize: 4,
      scale: scale,
      labelFormatter: xAxis === null || xAxis === void 0 ? void 0 : xAxis.labelFormatter,
      width: innerWidth,
      height: innerHeight,
      direction: 'horizontal',
    };
  }
}
