import define, { assertValueType } from "./index";

define("JSXAttribute", {
  visitor: ["name", "value"],
  aliases: ["JSX", "Immutable"]
});

define("JSXClosingElement", {
  visitor: ["name"],
  aliases: ["JSX", "Immutable"]
});

define("JSXElement", {
  aliases: ["JSX", "Immutable", "Expression"]
  visitor: ["openingElement", "children", "closingElement"],
});

define("JSXEmptyExpression", {
  aliases: ["JSX", "Expression"]
});

define("JSXExpressionContainer", {
  visitor: ["expression"],
  aliases: ["JSX", "Immutable"]
});

define("JSXIdentifier", {
  aliases: ["JSX", "Expression"]
});

define("JSXMemberExpression", {
  visitor: ["object", "property"],
  aliases: ["JSX", "Expression"]
});

define("JSXNamespacedName", {
  visitor: ["namespace", "name"],
  aliases: ["JSX"]
});

define("JSXOpeningElement", {
  visitor: ["name", "attributes"],
  aliases: ["JSX", "Immutable"]
});

define("JSXSpreadAttribute", {
  visitor: ["argument"],
  aliases: ["JSX"]
});

define("JSXText", {
  aliases: ["JSX"],
  builder: ["value"],
  fields: {
    value: { validate: assertValueType("string") }
  }
});

@@ -244,24 +244,161 @@
 Element%22, %7B%0A
+  builder: %5B%22openingElement%22, %22closingElement%22, %22children%22, %22selfClosing%22%5D,%0A  visitor: %5B%22openingElement%22, %22children%22, %22closingElement%22%5D,%0A
   aliases: %5B
@@ -434,69 +434,245 @@
 on%22%5D
+,
 %0A  
-visitor: %5B%22openingElement%22, %22children%22, %22closingElement%22%5D,
+fields: %7B%0A    openingElement: %7B%0A      validate: assertNodeType(%22JSXOpeningElement%22)%0A    %7D,%0A    closingElement: %7B%0A      optional: true,%0A      validate: assertNodeType(%22JSXClosingElement%22)%0A    %7D,%0A    children: %7B%0A      // todo%0A    %7D%0A  %7D
 %0A%7D);

add builder keys for JSXElement and add starter validation