import { Meta } from "@storybook/react";
import { PDFViewerProps } from "./PDFViewerProps";
import PDFViewer from "./PDFViewer";
import { SampleFileBase64 } from "./mockData/base64Sample";

export default {
  title: "Design System/PDFViewer",
  component: PDFViewer,
  tags: ["autodocs"],
  parameters: {
    docs: {
      description: {
        component:
          'The React PDFViewer library, part of KendoReact, allows users to view and interact with PDF files directly in the browser, without needing to download the file or use third-party tools or browser extensions. \n\n```javascript\nimport { PDFViewer } from "@renault-ui-library"\n```',
      },
    },
  },
  argTypes: {
    dataTestId: {
      control: { type: "text" },
      description: "Specifies the data-test-id attribute for testing purposes.",
    },
    id: {
      control: { type: "text" },
      description: "Unique identifier for the component",
    },
    arrayBuffer: {
      control: { type: "object" },
      description: "ArrayBuffer of the PDF file",
    },
    data: {
      control: { type: "text" },
      description: "Base64 string of the PDF file",
    },
    defaultZoom: {
      control: { type: "number" },
      description: "Default zoom level",
    },
    maxZoom: {
      control: { type: "number" },
      description: "Maximum zoom level",
    },
    minZoom: {
      control: { type: "number" },
      description: "Minimum zoom level",
    },
    saveFileName: {
      control: { type: "text" },
      description: "Default file name for saving the PDF",
    },
    saveOptions: {
      control: { type: "object" },
      description: "Options for saving the PDF",
    },
    style: {
      control: { type: "object" },
      description: "CSS styles",
    },
    tools: {
      control: { type: "array" },
      description: "Array of tools to display",
    },
    typedArray: {
      control: { type: "object" },
      description: "TypedArray of the PDF file",
    },
    url: {
      control: { type: "text" },
      description: "URL of the PDF file",
    },
    zoom: {
      control: { type: "number" },
      description: "Initial zoom level",
    },
    zoomLevels: {
      control: { type: "object" },
      description: "Custom zoom levels",
    },
    zoomRate: {
      control: { type: "number" },
      description: "Rate of zoom on scroll",
    },
    onDownload: {
      control: { type: "action" },
      description: "Event triggered when PDF is downloaded",
    },
    onError: {
      control: { type: "action" },
      description: "Event triggered when an error occurs",
    },
    onLoad: {
      control: { type: "action" },
      description: "Event triggered when PDF is loaded",
    },
    onPageChange: {
      control: { type: "action" },
      description: "Event triggered when the page changes",
    },
    onRenderContent: {
      control: { type: "action" },
      description: "Event triggered when content is rendered",
    },
    onRenderLoader: {
      control: { type: "action" },
      description: "Event triggered when the loader is rendered",
    },
    onRenderToolbar: {
      control: { type: "action" },
      description: "Event triggered when the toolbar is rendered",
    },
    onZoom: {
      control: { type: "action" },
      description: "Event triggered when zoom changes",
    },
  },
} as Meta;

export const Default = (args: PDFViewerProps): JSX.Element => (
  <PDFViewer data={SampleFileBase64} style={{ height: 615 }} />
);

Default.args = {
  dataTestId: "pdfviewer-data-testid",
};
