using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
[DataContract(Name ="ingredient")]
public class Ingredient
{
#region Attributes
[DataMember(Name ="id")]
private string name = "";
[DataMember(Name ="quantity")]
private Quantity quantity = new Quantity(1, Unit.unit) ;
#endregion
#region
///
/// Property of the Ingredient's attribute name. It raises an ArgumentNullException to prevent a nullable field.
///
public string Name
{
get => name;
set
{
if (value == null)
{
throw new ArgumentNullException("Impossible de ne pas avoir de nom pour l'ingrédient");
}
}
}
///
/// Property of the Ingredient's attribute Quantity.
///
public Quantity QuantityI
{
get => quantity;
set => quantity = value;
}
public bool Equals(Ingredient? other)
{
if (other == null) { return false; }
if (this == other) { return true; }
return Name.Equals(other.Name);
}
#endregion
#region Constructor
public Ingredient(string name, Quantity quantity)
{
Name = name;
QuantityI = quantity;
}
#endregion
}
}