(ns bigml-nodered-core.source
  (: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
   "Create Source"
   {:pre tasks/upload-source :wz tasks/wz-source }
   {:name "source"
    :module "source"
    :main "source"
    :in ["file"]
    :out ["source"]
    :options
    [["Name" {:type :text,
              :value "Source",
              :required true
              :internal true }]
     ["Project"
      {:type :text,
       :value "A project ID. The source will be created inside of
                the project identified by this ID."
       :placeholder ""
       :help ""}]
     ["Remote"
      {:type :text,
       :value "A URL pointing to a file containing your data in csv format."
       :placeholder "https://static.bigml.com/csv/iris.csv"
       :help ""}]
     ["File"
      {:type :text,
       :value "Path to a local file containing your data in csv format."
       :placeholder "/usr/local/iris.csv"
       :help ""}]
     ["Data"
      {:type :text,
       :value ""
       :placeholder "a,b,c,d\n1,2,3,4\n5,6,7,8"
       :help "Data for inline source creation."}]
     ["Synthetic"
      {:type :text,
       :value ""
       :placeholder "{ 'fields': 10, 'rows': 10, 'missing': 0.1 }"
       :help "Set of parameters to generate a synthetic source
       presumably for activities such as testing, prototyping and
       benchmarking."}]
     ["Disable datetime"
      {:type :boolean,
       :value false
       :help "Whether BigML has to generate or not new fields from
       existing date-time fields."}]
     ["Item analysis"
      {:type :text,
       :value ""
       :help "Set of parameters to activate item analysis for the source."}]
     ["Source parser"
      {:type :text,
       :value ""
       :help "Set of parameters to parse the source."}]
     ["Term analysis"
      {:type :text,
       :value ""
       :help "Set of parameters to activate text analysis for the source."}]
     ["Reify" {:type :boolean
               :value false 
               :internal true}]]}))

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