###
Common Functions for Data.
###

###
Returns the Name of the User. If tasked with full, the full name is returned
###
exports.get_name = (user, full, fn) ->
	fn user.name

###
Returns the Avatar of the User else if not found a default fallback
###
exports.get_avatar = (user, fn) -> 
	app.assets.get user.avatar, app.config.static_url + '/img/defaults/user.png', (url) ->
		fn url

###
Returns the System E-Mail of the User. This is the E-Mail each user receives to use on their CV.
###
exports.get_public_email = (user, fn) -> 
	fn ( process.env.USER_EMAIL_MASK or '{username}@curriculumvitae.co.za' ).replace '{username}', user.username

###
Returns the Profile URL of the User
###
exports.get_profile_url = (user, fn) -> 
	fn ( process.env.USER_PROFILE_MASK or 'http://www.curriculumvitae.co.za/u/{username}' ).replace '{username}', user.username