import { inject, computed, Reactive } from 'vue'
import type { NiConfig } from './types'

export function useNiConfig() {
  const config = inject<Reactive<NiConfig>>('ni-config')

  if (!config) {
    throw new Error('useConfig must be used within NiConfigProvider')
  }

  return {
    config: computed(() => config),
    get: (key: keyof NiConfig) => config[key],
    set: (key: keyof NiConfig, value: any) => {
      config[key] = value
    }
  }
} 