 {minOidLength, types, NativeRepository, NativeRemote} = bindings
 module.exports = Gitteh = {}
 
-oidRegex = /^[a-zA-Z0-9]{0,40}$/
-args.validators.oid = (val) ->
-	return false if typeof val isnt "string"
-	return false if not oidRegex.test val
-	return false if val.length < minOidLength
-	return true
-
-objectTypes = ["any", "blob", "commit", "tag", "tree"]
-args.validators.objectType = (val) ->
-	return objectTypes.indexOf val > -1
-
-remoteDirs = ["push", "fetch"]
-args.validators.remoteDir = (val) ->
-	return remoteDirs.indexOf val > -1
-
-checkOid = (str, allowLookup = true) ->
-	throw new TypeError "OID should be a string" if typeof str isnt "string"
-	throw new TypeError "Invalid OID" if not oidRegex.test str
-	throw new Error "OID is too short" if str.length < Gitteh.minOidLength
-	throw new TypeError "Invalid OID" if not allowLookup and str.length isnt 40
+getPrivate = (obj) ->
+	getPrivate.lock++
+	return obj._private
+getPrivate.lock = 0
+
+createPrivate = (obj) ->
+	_priv = {}
+	Object.defineProperty obj, "_private",
+		enumerable: false
+		configurable: false
+		get: ->
+			throw new Error "Bad request" if not getPrivate.lock--
+			return _priv
+	return _priv
 
 wrapCallback = (orig, cb) ->
 	return (err) ->

		.set("messageEncoding")
		.set("author")
		.set("committer")
	@tree = (cb) =>
		@repository.tree obj.tree, cb
	return @

Gitteh.Tree = Tree = (@repository, obj) ->
	obj._entries = obj.entries

		.set("tagger")
		.set("target", "targetId")
		.set("type")
	return @
Tag.prototype.target = (cb) ->
	@repository.object @targetId, @type, cb

Gitteh.Remote = Remote = (@repository, nativeRemote) ->
	_priv = createPrivate @
	_priv.native = nativeRemote
	_priv.connected = false

	if nativeRemote not instanceof NativeRemote
		throw new Error "Don't construct me, see Repository.remote()"

	Object.defineProperty @, "connected",
		get: -> return _priv.connected
		enumerable: true
		configurable: false

