/**
 * A small, profiled sample dataset for the landing page's Chart Builder demo.
 *
 * Portable core (no browser APIs, no React), the same neighborhood as
 * `examples.ts` and `theme-preview-specs.ts`. It exists so the landing's builder
 * widget can drive the *real* `chart-builder` core — `defaultBuilderConfig`,
 * `applyIntent`, `buildChartSpec` — over a column-typed dataset, the one piece of
 * sample data the existing fixtures don't provide (they are inline-data specs, not
 * tabular columns). Scoped to that single consumer; not a general API.
 *
 * The column roles are chosen so every chart intent applies (two categories, a
 * temporal, two measures), keeping the demo's intent strip fully live. The
 * declared `columnTypes`/`columnStats` are asserted against the rows in
 * `sample-dataset.test.ts`, so they can't drift from the data.
 */

import type { BuilderColumns } from './chart-builder';

export const SAMPLE_DATASET_NAME = 'sales-2024';

export const SAMPLE_DATASET_ROWS: ReadonlyArray<Record<string, string | number>> = [
  { month: '2024-01-01', region: 'North', channel: 'Web', revenue: 120, units: 34 },
  { month: '2024-01-01', region: 'South', channel: 'Retail', revenue: 95, units: 28 },
  { month: '2024-01-01', region: 'East', channel: 'Partner', revenue: 60, units: 15 },
  { month: '2024-02-01', region: 'West', channel: 'Web', revenue: 135, units: 39 },
  { month: '2024-02-01', region: 'North', channel: 'Retail', revenue: 110, units: 31 },
  { month: '2024-02-01', region: 'South', channel: 'Partner', revenue: 72, units: 18 },
  { month: '2024-03-01', region: 'East', channel: 'Web', revenue: 128, units: 36 },
  { month: '2024-03-01', region: 'West', channel: 'Retail', revenue: 101, units: 30 },
  { month: '2024-03-01', region: 'North', channel: 'Partner', revenue: 80, units: 21 },
  { month: '2024-04-01', region: 'South', channel: 'Web', revenue: 156, units: 44 },
  { month: '2024-04-01', region: 'East', channel: 'Retail', revenue: 118, units: 33 },
  { month: '2024-04-01', region: 'West', channel: 'Partner', revenue: 90, units: 24 },
  { month: '2024-05-01', region: 'North', channel: 'Web', revenue: 172, units: 48 },
  { month: '2024-05-01', region: 'South', channel: 'Retail', revenue: 130, units: 37 },
  { month: '2024-05-01', region: 'East', channel: 'Partner', revenue: 99, units: 26 },
  { month: '2024-06-01', region: 'West', channel: 'Web', revenue: 165, units: 46 },
  { month: '2024-06-01', region: 'North', channel: 'Retail', revenue: 142, units: 40 },
  { month: '2024-06-01', region: 'South', channel: 'Partner', revenue: 88, units: 23 },
];

export const SAMPLE_DATASET_COLUMNS: BuilderColumns = {
  columns: ['month', 'region', 'channel', 'revenue', 'units'],
  columnTypes: [
    { name: 'month', type: 'date' },
    { name: 'region', type: 'string' },
    { name: 'channel', type: 'string' },
    { name: 'revenue', type: 'number' },
    { name: 'units', type: 'number' },
  ],
  columnStats: [
    { name: 'month', distinct: 6, distinctCapped: false, numericExtent: null },
    { name: 'region', distinct: 4, distinctCapped: false, numericExtent: null },
    { name: 'channel', distinct: 3, distinctCapped: false, numericExtent: null },
    { name: 'revenue', distinct: 18, distinctCapped: false, numericExtent: { min: 60, max: 172 } },
    { name: 'units', distinct: 18, distinctCapped: false, numericExtent: { min: 15, max: 48 } },
  ],
};
