import type { Meta, StoryObj } from '@storybook/angular';
import type { DocumentCategory, Upload } from '@shared/upload/upload.machine';
import { DocumentCategoryComponent } from './document-category.component';

const meta: Meta<DocumentCategoryComponent> = {
  title: 'Organisms/DocumentCategory',
  component: DocumentCategoryComponent,
  render: (args) => ({
    props: args,
    template: `<app-document-category [category]="category" [uploads]="uploads" [channel]="channel" [rejection]="rejection" />`,
  }),
};
export default meta;
type Story = StoryObj<DocumentCategoryComponent>;

const category: DocumentCategory = {
  categoryId: 'diploma',
  label: 'Diploma',
  description: 'Een kopie van uw diploma (PDF, max 10 MB).',
  required: true,
  acceptedTypes: ['application/pdf'],
  maxSizeMb: 10,
  multiple: false,
  allowPostDelivery: true,
};

const uploads: Upload[] = [
  {
    localId: 'u-1',
    categoryId: 'diploma',
    fileName: 'diploma.pdf',
    fileSizeMb: 1.2,
    status: { type: 'complete', documentId: 'doc-1' },
    backgroundSync: false,
  },
];

export const Digital: Story = {
  args: { category, uploads, channel: 'digital', rejection: undefined },
};

export const WithRejection: Story = {
  args: { category, uploads: [], channel: 'digital', rejection: 'Dit bestandstype is niet toegestaan voor deze categorie.' },
};
