import { z } from 'zod'
import { pikkuSessionlessFunc } from '#pikku'

export const ProcessCardEventInput = z.object({
  cardId: z.string(),
  action: z.string(),
  status: z.string(),
  createdAt: z.string(),
})

/**
 * Queue worker for `cardEvents`. Just logs the event for now — real
 * implementations would fan out to webhooks, refresh search indexes, push
 * mobile notifications, etc.
 */
export const processCardEvent = pikkuSessionlessFunc({
  input: ProcessCardEventInput,
  func: async ({ logger }, { cardId, action, status }) => {
    logger.info(`processCardEvent ${action} card=${cardId} status=${status}`)
  },
})
