package com.prolog.cs.biz.outbound.service.impl;

import java.util.ArrayList;
import java.util.List;

public class SortRules
{
    private List<SortRule> SortRules = new ArrayList<>();

    static public class SortRule
    {
        String fieldName;

        public String getFieldName()
        {
            return fieldName;
        }

        public void setFieldName(String fieldName)
        {
            this.fieldName = fieldName;
        }

        public OrderBy getOrderBy()
        {
            return orderBy;
        }

        public void setOrderBy(OrderBy orderBy)
        {
            this.orderBy = orderBy;
        }

        OrderBy orderBy;

        public SortRule(String filedName, OrderBy orderBy)
        {
            this.fieldName = filedName;
            this.orderBy = orderBy;
        }

        public enum OrderBy
        {
            ASC, DESC;
        }

    }

    public void addRule(SortRule sortRule)
    {
        SortRules.add(sortRule);
    }

    public void addRule(String filedName, SortRule.OrderBy orderBy)
    {
        SortRule sortRule = new SortRule(filedName, orderBy);
        SortRules.add(sortRule);
    }

    public List<SortRule> getSortRules()
    {
        return SortRules;
    }

}
