import type { Preview } from '@storybook/angular';
import { componentWrapperDecorator } from '@storybook/angular';
import { setCompodocJson } from '@storybook/addon-docs/angular';
import docJson from '../documentation.json';
setCompodocJson(docJson);

const preview: Preview = {
  // CIBG/Bootstrap styles bare elements — no theme wrapper class needed; just pad.
  // The token bridge lives in styles.scss (loaded via the app build target).
  decorators: [
    componentWrapperDecorator((story) => `<div style="padding:1.5rem">${story}</div>`),
  ],
  parameters: {
    layout: 'padded',
    // Accessibility (axe) via @storybook/addon-a11y. Runs WCAG 2.0/2.1 A+AA rule
    // sets on every story; flag violations in the a11y panel.
    a11y: {
      config: { runOnly: { type: 'tag', values: ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'] } },
    },
    controls: {
      matchers: {
        color: /(background|color)$/i,
        date: /Date$/i,
      },
    },
  },
};

export default preview;
