let _value = $state<any[]>([])
let _tracked = $state<string[]>([])

export const jobsStore = {
  get value() { return _value },
  set(jobs: any[]) { _value = jobs || [] },
  get tracked() { return _tracked },
  track(id: string) { if (!_tracked.includes(id)) _tracked = [..._tracked, id] },
  toggle(id: string) {
    _tracked = _tracked.includes(id)
      ? _tracked.filter(x => x !== id)
      : [..._tracked, id]
  },
}
