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

using EQNetwork.Utility;
using EQNetwork.Aspects;

namespace EQNetwork.Objects
{
    public class ListCollectionsContext : PropertyChangeTracker
    {
        public enum SortOrder
        {
            Alpha,
            Recent,
            Popularity,
            Comments,
        };

        // OPTIONS (all one way... sent to backend)

        /// <summary>
        /// Limit results to SearchFilters options
        /// </summary>
        [TrackPropertyChanged()]
        [SerializePropertyValuesInline()]
        public SearchFilters SearchFilters { get; set; }

        /// <summary>
        /// Limit results to include or not include empty Collections
        /// </summary>
        [TrackPropertyChanged()]
        public bool? IncludeEmpty { get; set; }

        /// <summary>
        /// Limit results to include or not include Users that are being followed (as pseudo collection items)
        /// </summary>
        [TrackPropertyChanged()]
        public bool? includeUsers { get; set; }

        /// <summary>
        /// Sorts results so that collections with notifications show up first
        /// </summary>
        [TrackPropertyChanged()]
        public bool? NotificationCountInSort { private get; set; }

        /// <summary>
        /// Limit results to include or not include these User_CollectionTypes (e.g. 
        /// </summary>
        [TrackPropertyChanged()]
        [SerializeWith("User_CollectionTypeIds")]
        public List<Db.User_CollectionType> User_CollectionTypes { get; set; }

        public string User_CollectionTypeIds
        {
            get
            {
                StringBuilder sb = new StringBuilder();
                foreach (var item in User_CollectionTypes)
                {
                    if (sb.Length > 0) sb.Append(",");
                    sb.Append((int)item);
                }
                return sb.ToString();
            }
        }

        public ListCollectionsContext()
        {
            User_CollectionTypes = new List<Db.User_CollectionType>() { Db.User_CollectionType.Owner };
        }

    }
}
