using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataAccessLayer.Filtering
{
    public class Filter
    {
        public IEnumerable<ConditionItem> Conditions { get; set; }
        public int? PageSize { get; set; }
        public int? Page { get; set; }
        public IEnumerable<SortingItem> Sorting { get; set; }
    }

    public class ConditionItem
    {
        public ConditionTypeEnum Type { get; set; }

        public ConditionItem Left { get; set; }

        public ConditionItem Right { get; set; }

        public ConditionItem Condition { get; set; }

        public string Column { get; set; }

        public string Value { get; set; }
    }

    public class SortingItem
    {
        public string Column { get; set; }

        public bool Ascending { get; set; }
    }

    public enum ConditionTypeEnum
    {
        Unknown = 0,
        Not = 1,
        And = 10,
        Or = 11,
        Equal = 100,
        NotEqual = 101,
        Less = 102,
        LessOrEqual = 103,
        Greater = 104,
        GreaterOrEqual = 105,
        Contains = 200,
        NotContains = 201,
        StartsWith = 202,
        NotStartsWith = 203,
        EndsWith = 204,
        NotEndsWith = 205,
    }
}
