'use strict';

var tv4 = require('tv4');
var formats = require('tv4-formats');
var json = tv4.freshApi();

// generic formats
json.addFormat(formats);

// custom formats
json.addFormat('throwUniqueError', function (data, schema) {
    return data.table + ': ' + data.property + ', ' + data.value + ' already exists';
});

json.addFormat('throwForeignKeyError', function (data, schema) {
    return data.property + ', ' + data.key + ' does not exist within: ' + data.table + '\'s collection';
});

module.exports = json;
