'use strict';

const Types = require('paradox-utils').SchemaTypes;
const uuidv4 = require('uuid/v4');

/**
 *  @param  {Dblize}  dblize
 *  @return {Object}  model
 **/
module.exports = function(dblize) {
    let Model = dblize.define('user_token', {
        user_key: {
            type: Types.STRING,
        },
        enabled: {
            type: Types.BOOLEAN,
        },
        token: {
            type: Types.STRING,
            get(value) {
                return value || uuidv4();
            }
        },
        description: {
            type: Types.STRING,
        },
    });

    return Model;
};