module.exports = (sequelize, DataTypes) => {
    let UnbanRequest = sequelize.define('UnbanRequest', {
        reason: {
            type: DataTypes.STRING,
            validate: {
                isString (val) {
                    if(typeof val !== 'string') {
                        throw new sequelize.ValidationError('UnbanRequest text must be a string')
                    }
                }
            }
        },
        UserId: {
            type: DataTypes.INTEGER
        }
    }, {
        classMethods: {
            InvalidUserId (value) {
                return new sequelize.ValidationError('User ID is not valid', [
                    new sequelize.ValidationErrorItem(
                        'User ID is not valid',
                        'Validation error',
                        'userId',
                        value
                    )
                ])
            }
        }
    })

    return UnbanRequest
}
