(ns bigml-nodered-core.reify
  (:require [bigml-nodered-core.wz :as wz]
            [bigml-nodered-core.wz.tasks :as tasks]
            [bigml-nodered-core.wz.marshal :as marshal]
            [bigml-nodered-core.utils :as utils])
  (:require-macros [bigml-nodered-core.macros :as macros]))

(defn- create-node []
  (macros/create-node
   "Reify"
   tasks/wz-get
   {:name "reify"
    :main "reify"
    :in ["json"]
    :out ["result"]
    :options
    [["Name" {:type :text,
              :value "Reify",
              :required true
              :internal true }]
     ["Input keypath"
      {:type :text
       :value ""
       :help "A keypath used to extract a BigML resource ID from the
       incoming payload. The corresonding resource will be fetched
       from BigML."}]
     ["Output keypath"
      {:type :text
       :value "" 
       :help "A keypath used to filter in only a property of the retrieved resource JSON."}]
     ["Reify" {:type :boolean
               :value true
               :internal true
               :help "This node will GET the resource specified via
               its <code>Input keypath</code> input and will output
               the <code>Output keypath</code> from the resource
               JSON. In addition, this node will execute the WhizzML
               code generated at this (and upstream) node(s). You need
               to enable this option if you want to get a result from
               your flow that you can pass to a non-BigML node."}]]}))

;; (jsassoc js/module "exports" { :input input }) 
(set! (.-exports js/module) (utils/export-nodes { "reify" (create-node)}))
