using System; using System.Collections; using System.Drawing; using InABox.Core; using Xamarin.Essentials; namespace comal.timesheets { public interface IAssignmentLookupDataModel { IEnumerable Items { get; } } public abstract class AssignmentLookupDataModel : ListDataModel, IAssignmentLookupDataModel where TEntity : Entity, IRemotable, IPersistent, new() where TShell : AssignmentLookupItem, new() { IEnumerable IAssignmentLookupDataModel.Items => Items; public void Clear() { foreach (var item in Items) item.Selected = false; } public void Select(Guid id) { foreach (var item in Items) item.Selected = item.Id == id; } } public abstract class AssignmentLookupItem : CoreDataModelItem { public abstract Guid Id { get; } public abstract String Number { get; } public abstract String Name { get; } public abstract String Description { get; } public bool Selected { get; set; } public Color Colour => Selected ? Color.LightPink : Color.White; } }