using ZionExtractor.Models;
using System.Collections.Generic;
using System.Linq;

namespace ZionExtractor.Controllers.LegworkFilters
{
    class Quality
    {
        public static Hypothesis Higher(List<Hypothesis> fields)
        {
            var quality = (from Hypothesis field in fields
                           select field.Quality).Max();

            return (from Hypothesis field in fields
                    where field.Quality == quality
                    select field).ToList().First();
        }

        public static Hypothesis Lower(List<Hypothesis> fields)
        {
            var quality = (from Hypothesis field in fields
                           select field.Quality).Min();

            return (from Hypothesis field in fields
                    where field.Quality == quality
                    select field).ToList().First();
        }
    }
}
