import type { Knex } from 'knex';

/** Development only: a few inbox messages so the admin Inbox isn't empty. Skipped in production. */
export async function seed(knex: Knex): Promise<void> {
  if (process.env.NODE_ENV === 'production') return;
  const [{ n }] = await knex('contact_messages').count({ n: '*' });
  if (Number(n) > 0) return;
  await knex('contact_messages').insert([
    {
      name: '[Name]',
      contact: '[email address]',
      topic: 'mistake',
      message: 'The pack size shown for this suppository looks wrong.',
      page_ref: 'napa-500-mg-suppository',
      status: 'new',
    },
    {
      name: '[Name]',
      contact: '[phone]',
      topic: 'missing',
      message: 'Please add [Brand] 10 mg tablet.',
      page_ref: null,
      status: 'new',
    },
    {
      name: '[Name]',
      contact: '[email address]',
      topic: 'photo',
      message: 'I can send a clear photo of the Ace syrup box.',
      page_ref: 'ace-120-mg-5-ml-syrup',
      status: 'in_progress',
    },
    {
      name: '[Name]',
      contact: '[email address]',
      topic: 'mistake',
      message: 'Company name is missing on this page.',
      page_ref: 'abeclib-200-mg-tablet',
      status: 'resolved',
    },
  ]);
}
