using System;
using System.ComponentModel.DataAnnotations;
using Qusion.WebApp.Areas.Qusion.Filters;

namespace Qusion.WebApp.Areas.Qusion.Models.Pages
{
    public sealed class PageEditInput
    {
        /// <summary>
        /// Gets or sets page id.
        /// </summary>
        public Guid ID { get; set; }

        /// <summary>
        /// Gets or sets page title.
        /// </summary>
        [Required(ErrorMessage = "pages.required_title")]
        public string Title { get; set; }

        /// <summary>
        /// Gets or sets page alias
        /// </summary>
        [Required(ErrorMessage = "pages.required_alias")]
        public string Alias { get; set; }

        /// <summary>
        /// Gets or sets page workflow status.
        /// </summary>
        public int Status { get; set; }

        /// <summary>
        /// Gets or sets page type.
        /// </summary>
        public string PageType { get; set; }

        /// <summary>
        /// Gets or sets page parent.
        /// </summary>
        public Guid? ParentID { get; set; }

        /// <summary>
        /// Indicate is page navigable.
        /// </summary>
        public bool Navigable { get; set; }

        /// <summary>
        /// Indicate if page require ssl.
        /// </summary>
        public bool RequireSSL { get; set; }

        /// <summary>
        /// Indicate if page allow anonymous access
        /// </summary>
        public bool AllowAnonymous { get; set; }

        /// <summary>
        /// Gets or sets external url. Only for pagetype equal External.
        /// </summary>
        [RequiredIf("PageType", "External", "pages.require_external")]
        [DataType(DataType.Url)]
        [Url(ErrorMessage = "pages.invalid_external")]
        public String ExternalUrl { get; set; }

        /// <summary>
        /// Gets or sets id of page for internal redirection.
        /// </summary>
        [RequiredIf("PageType", "InternalRedirect", "pages.require_internal")]
        public Guid? InternalRedirectID { get; set; }

        public int Ordinal { get; set; }
    }
}