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

using CommunityServer.Components;

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

		public GalleryThreadQuery() { }

		#region Query Properties

		/// <summary>
		/// Require posts be marked as Published/Active
		/// </summary>
		public GalleryPostPublishedFilter PublishedFilter = GalleryPostPublishedFilter.All;

		/// <summary>
		/// Type of thread (date, recent, etc)
		/// </summary>
		public GalleryThreadType GalleryThreadType = GalleryThreadType.Recent;

		/// <summary>
		/// Column to sort by
		/// </summary>
		public GalleryThreadSortBy SortBy = GalleryThreadSortBy.PictureDate;

		/// <summary>
		/// ApplicationPostType to filter by
		/// </summary>
		public GalleryPostType ApplicationPostType = GalleryPostType.Image | GalleryPostType.Comment;

		#endregion
		
		#region Has/Helpers

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

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

		#endregion

	}
}
