import type { Meta, StoryObj } from '@storybook/react';
import { VirtualizedChatMessages } from './VirtualizedChatMessages';

const meta: Meta<typeof VirtualizedChatMessages> = {
    title: 'Components/Features/Chat/VirtualizedChatMessages',
    component: VirtualizedChatMessages,
    parameters: { layout: 'padded' },
    tags: ['autodocs'],
    decorators: [
        (Story) => (
            <div className="bg-kodo-background p-4 min-h-screen">
                <Story />
            </div>
        ),
    ],
};

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

const mockMessages = [
    {
        id: '1',
        content: 'Hello world',
        sender: { username: 'User1' },
        created_at: new Date().toISOString(),
    },
    {
        id: '2',
        content: 'Hi there!',
        sender: { username: 'User2' },
        created_at: new Date().toISOString(),
    },
];

export const Default: Story = {
    name: 'Par défaut',
    args: {
        messages: mockMessages,
        hasNextPage: false,
        isFetching: false,
        fetchNextPage: () => { },
    },
};

export const Loading: Story = {
    name: 'Chargement',
    args: {
        messages: [],
        hasNextPage: false,
        isFetching: true,
        fetchNextPage: () => { },
    },
};
