import {ProductLink} from '../components/commerce/product-link'
import {createProduct, injectMocks} from '../mocks'

import type {Meta, StoryObj} from '@storybook/react-vite'

const meta = {
  title: 'Commerce/ProductLink',
  component: ProductLink,
  parameters: {
    layout: 'padded',
  },
  args: {},
  tags: ['autodocs'],
} satisfies Meta<typeof ProductLink>

export default meta
type Story = StoryObj<typeof meta>

injectMocks()

export const Default: Story = {
  args: {
    product: createProduct('1', 'Teapot', '100', '120'),
  },
}

export const WithDiscount: Story = {
  args: {
    product: createProduct('2', 'Discounted Teapot', '80', '120'),
  },
}

export const List: Story = {
  decorators: [
    Story => (
      <div className="grid grid-cols-1 gap-4 max-w-md">
        <Story />
        <Story />
        <Story />
      </div>
    ),
  ],
  args: {
    product: createProduct('1', 'Teapot', '100', '120'),
  },
}
