//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System.Collections;
using CommunityServer.Components;

namespace CommunityServer.Files.Components
{
	/// <summary>
	/// Summary description for EntryQuery.
	/// </summary>
	public class FileGalleryThreadQuery : ThreadQuery
	{

		public FileGalleryThreadQuery() : base()
		{
		}

		#region Query Properties

		public bool OnlyApproved = true;
		public bool OnlyUnapproved = true;

		/// <summary>
		/// Column to sort by
		/// </summary>
		public EntriesSortBy SortBy = EntriesSortBy.Subject;

		/// <summary>
		/// Thread type to get
		/// </summary>
		public EntryListType ThreadType = EntryListType.Recent;

		/// <summary>
		/// ApplicationPostType to filter by
		/// </summary>
		public FileGalleryPostType ApplicationPostType = FileGalleryPostType.File;

		#endregion
		
		#region Has/Helpers

		/// <summary>
		/// Are we filtering by a category?
		/// </summary>
		public bool HasCategory
		{
			get{return CategoryID > 0;}
		}

		/// <summary>
		/// Are we filtering by a specific blog?
		/// </summary>
		public bool HasFolder
		{
			get{return SectionID > -1;}
		}

		/// <summary>
		/// Are we filtering by a specific group?
		/// </summary>
		public bool HasGroup
		{
			get{return GroupID > -1;}
		}

		/// <summary>
		/// Unquie key represeting the current query
		/// </summary>
		public string Key
		{
			get
			{
				return string.Format("C:{0}-PI{1}-PS:{2}-C:{3}-CTT:{4}-CSB:{5}-SO:{6}-IC:{7}-U:{8}-GID:{9}-F:{10}-L:{11}-OT:{12}-T:{13}",
					SectionID,PageIndex,PageSize,CategoryID,ThreadType,SortBy,SortOrder,IncludeCategories,UserID,GroupID,FilterKey,this.SectionID < 0 ? CSContext.Current.User.FilterLanguagesCacheKey : "", this.LogicallyOrTags.ToString(), this.FilterByTags ? System.String.Join("\n", this.Tags) : "");
			}
		}

		#endregion

	}
}
