import { Box } from '@mui/material';
import { type Meta, type StoryObj } from '@storybook/react-vite';

import dummyPdf from '../../../../static/prueba-texto-largo.pdf';

import PdfVisualizer from '.';

const meta: Meta<typeof PdfVisualizer> = {
  component: PdfVisualizer,
  title: 'Composed Components/PdfVisualizer',
  tags: ['autodocs'],
  decorators: [
    Story => (
      <Box sx={{ height: '800px', border: '1px solid #e0e0e0' }}>
        <Story />
      </Box>
    ),
  ],
  args: {
    file: dummyPdf,
  },
  argTypes: {
    file: {
      control: 'text',
      description: 'PDF file URL or File object',
    },
    defaultPage: {
      control: { type: 'number', min: 1 },
      description: 'Default page to display on load',
    },
  },
};

export default meta;

type Story = StoryObj<typeof PdfVisualizer>;

export const Default: Story = {
  args: {},
};

export const StartAtPage3: Story = {
  args: {
    defaultPage: 3,
  },
};

export const WithoutSidebar: Story = {
  args: {
    slotProps: { sidebar: { show: false } },
  },
};

export const SidebarExpandedByDefault: Story = {
  args: {
    slotProps: { sidebar: { defaultExpanded: true } },
  },
};
