import { create } from 'zustand'
import type { PendingPipelineItem } from '../domain/pipeline'

export type { PendingPipelineItem }

interface PipelineUIStore {
  dialogOpen: boolean
  pendingItem: PendingPipelineItem | null
  openSavedDialog: (item: PendingPipelineItem) => void
  closeSavedDialog: () => void
}

export const usePipelineStore = create<PipelineUIStore>((set) => ({
  dialogOpen: false,
  pendingItem: null,
  openSavedDialog: (item) => set({ dialogOpen: true, pendingItem: item }),
  closeSavedDialog: () => set({ dialogOpen: false, pendingItem: null }),
}))
