 url = require 'url'
 
 # ArangoDB Query Builder
+ajs = require 'arangojs'
 qb = require 'aqb'
 
 debug = require('debug') 'loopback:connector:arango'

  
    @param dataSource [DataSource] The data source instance
  ###
  constructor: (dataSource) ->
    console.log 'constructor'
    Connector.call this, 'arangodb', dataSource.settings
    @dataSource = dataSource
    @dataSource.connector = this
    
    settings = dataSource.settings or {}
    @settings = settings
    
    @name = 'arangodb'
    @_models = {}
    
    @arangoConfig = connectionConfig @settings
    @qb = require('aqb')
    
    return this
  
  
  # one file per functionality
  @extend require('./core')
  @extend require('./crud')
  @extend require('./migration')

require('util').inherits ArangoDBConnector, Connector

exports.ArangoDBConnector = ArangoDBConnector
  @param callback [Function] The callback function
###
exports.initialize = (dataSource, callback) ->
  return if not ajs?
  dataSource.driver = ajs;
  
  settings = generateArangoDBObject dataSource.settings
  
  dataSource.connector = new ArangoDBConnector settings, dataSource
  # dataSource.connector.connect callback if callback?


###
