using FoodsharingSiegen.Contracts.Entity;
using FoodsharingSiegen.Contracts.Enums;
using FoodsharingSiegen.Server.BaseClasses;
using Microsoft.AspNetCore.Components;
namespace FoodsharingSiegen.Server.Controls
{
///
/// The interaction row class (a. beging, 31.05.2022)
///
public partial class InteractionRow : FsBase
{
#region Parameters
///
/// Gets or sets the value of the add click (ab)
///
[Parameter]
public Func? AddClick { get; set; }
///
/// Gets or sets the value of the allow add interaction (ab)
///
[Parameter]
public bool AllowInteraction { get; set; }
///
/// Gets or sets the value of the button text (ab)
///
[Parameter]
public string? ButtonIconClass { get; set; }
///
/// Gets or sets the value of the icon class (ab)
///
[Parameter]
public string? IconClass { get; set; }
///
/// Gets or sets the value of the minimum (ab)
///
[Parameter]
public int Minimum { get; set; } = 1;
///
/// Gets or sets the value of the multiple (ab)
///
[Parameter]
public bool Multiple { get; set; }
///
/// Gets or sets the value of the prospect (ab)
///
[Parameter]
public Prospect? Prospect { get; set; }
///
/// Gets or sets the value of the remove click (ab)
///
[Parameter]
public Func? RemoveClick { get; set; }
///
/// Gets or sets the value of the type (ab)
///
[Parameter]
public InteractionType Type { get; set; }
#endregion
#region Private Properties
///
/// Gets the value of the alert (ab)
///
private bool Alert => Interactions.Any(x => x.Alert);
///
/// Gets the value of the done (ab)
///
private bool Done => Interactions.Count >= Minimum;
///
/// Gets the value of the interactions (ab)
///
private List Interactions => Prospect?.Interactions.Where(x => x.Type == Type).ToList() ?? [];
///
/// Gets the value of the not needed (ab)
///
private bool NotNeeded => Interactions.Any(x => x.NotNeeded);
#endregion
}
}