// Registration (aka Inscription) model

'use strict';

var memoize           = require('memoizee/plain')
  , validDb           = require('dbjs/valid-dbjs')
  , defineStringLine  = require('dbjs-ext/string/string-line')
  , defineInstitution = require('./institution');

module.exports = memoize(function (db) {
	var StringLine = defineStringLine(validDb(db))
	  , Institution = defineInstitution(validDb(db));

	return db.Object.extend('Registration', {
		label: {
			type: StringLine,
			value: function () {
				var Document = this.constructor.Document;
				return Document ? Document.label : null;
			}
		},
		shortLabel: {
			type: StringLine,
			value: function () {
				return this.label;
			}
		},
		certificates: {
			type: StringLine,
			multiple: true,
			value: function () { return [this.key]; }
		},
		requirements: {
			type: StringLine,
			multiple: true
		},
		costs: {
			type: StringLine,
			multiple: true
		},
		isMandatory: {
			type: db.Boolean,
			value: true
		},
		isApplicable: {
			type: db.Boolean,
			value: true
		},
		isRequested: {
			type: db.Boolean,
			value: true
		}
	}, {
		Document: { type: db.Base }, // It should be a type: Type, but can't be defined like that now
		abbr: { type: StringLine },
		institution: { type: Institution },
		isElectronic: { type: db.Boolean, value: false }
	});
}, { normalizer: require('memoizee/normalizers/get-1')() });

@@ -103,21 +103,22 @@
 n')%0A  , 
-valid
+ensure
 Db      
@@ -341,21 +341,22 @@
 ingLine(
-valid
+ensure
 Db(db))%0A
@@ -392,21 +392,22 @@
 itution(
-valid
+ensure
 Db(db));

Rename validDb to ensureDb