import React from 'react';
import {Meta, StoryObj} from '@storybook/react';
import {AttachmentType} from '@interfaces/attachments';

import {Attachment} from './index';

const attachments = [
  {
    id: 1,
    item: {
      id: 1,
      name: 'Prueba attachments.pptx',
      type: AttachmentType.PRESENTATION,
      size: '895 Bytes',
    },
  },
  {
    id: 2,
    item: {
      id: 1,
      name: 'Imagen.png',
      size: '89 Bytes',
    },
  },
  {
    id: 3,
    item: {
      id: 1,
      name: 'Mucho pero mucho pero mucho pero mucho pero mucho pero mucho texto.gif',
      size: '1009 Bytes',
    },
  },
  {
    id: 4,
    item: {
      id: 1,
      name: 'Poco texto.doc',
      size: '2 Bytes',
    },
  },
  {
    id: 5,
    item: {
      id: 1,
      name: 'esto es un.pdf',
      size: '1009 Bytes',
    },
  },
  {
    id: 6,
    item: {
      id: 1,
      name: 'Ultimo.xlsx',
      size: '1009 Bytes',
    },
  },
];

const meta: Meta<typeof Attachment> = {
  title: 'HuGo/Attachment',
  component: Attachment,
  argTypes: {},
};

type Story = StoryObj<typeof Attachment>;

export const AttachmentComponent: Story = {
  args: {
    onPress: () => {},
  },
  render: args => (
    <>
      {attachments.map(att => (
        <Attachment key={att.id} {...args} {...att.item} />
      ))}
    </>
  ),
};

export default meta;
