(ns bigml-nodered-core.wzpack
  (: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
   "WhizzML Package"
   {:post tasks/package-exec}
   {:name "package"
    :module "wzpack"
    :main "wzpack"
    :in []
    :out ["result"]
    :options
    [["Name" {:type :text,
              :value "WhizzML Package",
              :required true
              :internal true }]
     ["Meta URL"
      {:type :text
       :placeholder
       "https://raw.githubusercontent.com/whizzml/examples/master/cross-validation/" 
       :help "The URL of the WhizzML package to execute."}]
     ["Meta input"
      {:type :json,
       :value ""
       :placeholder "[[\"key\", \"value\"]]"
       :help "A JSON representing the inputs for the package. "}]
     ["Meta" {:type :boolean
               :value true
               :internal true }]]}))

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