import { pikkuWorkflowGraph } from '#pikku/workflow/pikku-workflow-types.gen.js'

export const cardOnboardingWorkflow = pikkuWorkflowGraph({
  description: 'Enrich a new card, persist it, then notify',
  tags: ['kanban', 'onboarding'],
  nodes: { enrich: 'enrichCard', create: 'createCard', notify: 'notifyCardCreated' },
  config: {
    enrich: { next: 'create' },
    create: {
      next: 'notify',
      input: (ref) => ({ title: ref('enrich', 'title'), status: ref('enrich', 'status') }),
    },
    notify: {
      input: (ref) => ({
        cardId: ref('create', 'cardId'),
        title: ref('create', 'title'),
        priority: ref('enrich', 'priority'),
        labels: ref('enrich', 'labels'),
      }),
    },
  },
})
