 {resolveType} = require '../typeresolution'
 
 
+# Takes object type node and lists its property nodes.
 listProperties = (objectType, cb) ->
   props = []
   for member in (objectType.sections or []) when member.type is 'member'

  ], cb


handleArray = (arrayType, simpleTypeSpec, options, cb) ->
  cb null, type: 'array'


handlePrimitiveType = (primitiveType, simpleTypeSpec, options, cb) ->
  cb null, type: simpleTypeSpec.name


handleType = (type, options, cb) ->
  resolveType type, (err, simpleTypeSpec) ->
    return cb err if err

  ], cb


# Turns multiple property nodes into 'resolved properties', i.e. objects
# carrying both representations of those properties in JSON Schema
# and also additional info, such as property names, attributes, etc.
resolveProperties = (props, options, cb) ->
  async.map props, (prop, next) ->
    resolveProperty prop, options, next
  , cb


# Takes 'resolved properties' and generates JSON Schema
# for their wrapper object type node.
buildObjectSchema = (resolvedProps, options, cb) ->
  schemaProps = {}
  schemaRequired = []
