import { moduleMetadata, type Meta, type StoryObj } from '@storybook/angular';

import { DownloadButtonComponent } from '../../../../design-component/src/lib/download-button/download-button.component';

import { AttachmentHeaderComponent } from '../attachment-header/attachment-header.component';
import { AttachmentComponent } from '../attachment/attachment.component';
import { AttachmentWrapperComponent } from './attachment-wrapper.component';

const meta: Meta<AttachmentWrapperComponent> = {
  title: 'Wrappers/Attachment wrapper',
  component: AttachmentWrapperComponent,
  parameters: {
    docs: {
      description: {
        component: 'Wrapper for multiple attachments',
      },
    },
  },
  decorators: [
    moduleMetadata({
      imports: [
        AttachmentWrapperComponent,
        AttachmentComponent,
        DownloadButtonComponent,
        AttachmentHeaderComponent,
      ],
    }),
  ],
  excludeStories: /.*Data$/,
  tags: ['autodocs'],
};

export default meta;
type Story = StoryObj<AttachmentWrapperComponent>;

export const Default: Story = {
  render: () => ({
    template: `<ods-attachment-wrapper>
        <ods-attachment-header title="Anhänge">
          <ods-download-button action-buttons />
        </ods-attachment-header>
        <ods-attachment caption="Attachment" description="200 kB" fileType="pdf"></ods-attachment>
        <ods-attachment caption="Second attachment" description="432 kB" fileType="doc"></ods-attachment>
    </ods-attachment-wrapper>`,
  }),
};