using Models;

namespace ShoopNCook.Views;

public partial class IngredientView : ContentView
{

    private readonly BindableProperty NameProperty =
        BindableProperty.Create(nameof(Name), typeof(string), typeof(IngredientView), default(string));

    private readonly BindableProperty QuantityProperty =
        BindableProperty.Create(nameof(Quantity), typeof(float), typeof(IngredientView), default(float));

    private readonly BindableProperty UnitProperty =
        BindableProperty.Create(nameof(Unit), typeof(string), typeof(IngredientView), default(string));

    public string Name
    {
        get => (string)GetValue(NameProperty);
        set => SetValue(NameProperty, value);
    }

    public float Quantity
    {
        get => (float)GetValue(QuantityProperty);
        set => SetValue(QuantityProperty, value);
    }

    public string Unit
    {
        get => (string)GetValue(UnitProperty);
        set => SetValue(UnitProperty, value);
    }

    public IngredientView(Ingredient ingredient)
    {
        InitializeComponent();

        Name = ingredient.Name;
        Quantity = ingredient.Amount;
        //TODO Unit implementation in IngredientView.xaml.cs
        Unit = "TODO: Unit implementation in IngredientView.xaml.cs";
    }
}