{"size": 1098, "ext": "js", "max_stars_repo_path": "modules/recipe.js", "max_stars_repo_name": "ladj82/recipes-search", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "modules/recipe.js", "max_issues_repo_name": "ladj82/recipes-search", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "modules/recipe.js", "max_forks_repo_name": "ladj82/recipes-search", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.9545454545, "max_line_length": 97, "alphanum_fraction": 0.6803278689}
'use strict';

var Utility = require('../modules/utility');

/**
 * Recipe constructor.
 * @constructor
 * @param {string} name - Recipe's name.
 * @param {string} url - Recipe's URL.
 * @param {string} thumbnail - Recipe's Thumbnail URL.
 * @param {string} ingredients - Recipe's ingredients separated by comma.
 * @requires module:modules/utility
 */
function Recipe(name, url, thumbnail, ingredients) {
	this.name = name || null;
	this.url = url || null;
	this.thumbnail = thumbnail || null;
	this.ingredients = ingredients || null;

	Utility.objectStringPropertiesSanitizer(this, Utility.stringSanitizer);
}

/**
 * Return the string representation of recipe's object.
 * @returns {string} Recipe's string.
 */
Recipe.prototype.toString = function() {
	return 'Name: ' + this.name + '\n' + 'URL: ' + this.url + '\n' + 'Thumbnail: ' + this.thumbnail;
}

/**
 * Check if the Recipe object is valid.
 * @todo Add better validation on next sprint.
 * @return {boolean}
 */
Recipe.prototype.isValid = function() {
	if (!this.thumbnail) {
		return false;
	}

	return true;
}

module.exports = Recipe;