using System.Collections.Generic;
using System.Linq;

namespace InABox.Core
{
    public class DigitalFormLookups : EntityLookup<DigitalForm>
    {
        public override Columns<DigitalForm> DefineColumns()
        {
            return base.DefineColumns()
                .Add(x => x.Group.Description)
                .Add(x => x.Description)
                .Add(x => x.AppliesTo);
        }

        public override string FormatLookup(Dictionary<string, object?> values, IEnumerable<string> exclude)
        {
            return LookupFactory.DefaultFormatLookup(values, exclude.Concat(new[] { "ID", "AppliesTo" }));
        }

        public override Filter<DigitalForm> DefineFilter()
        {
            return new Filter<DigitalForm>(x => x.Active).IsEqualTo(true);
        }

        public override SortOrder<DigitalForm> DefineSortOrder()
        {
            return new SortOrder<DigitalForm>(x => x.Group.Description).ThenBy(x => x.Description);
        }
    }
}