using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Oqtane.Models
{
///
/// Describes a Page in Oqtane
///
public class Page : ModelBase, IDeletable
{
///
/// Id of the Page
///
public int PageId { get; set; }
///
/// Reference to the .
///
public int SiteId { get; set; }
///
/// Path of the page.
/// TODO: todoc relative to what? site root, parent-page, domain?
///
public string Path { get; set; }
///
/// Reference to the parent if it has one.
///
public int? ParentId { get; set; }
///
/// Page Name.
/// TODO: todoc where this is used
///
public string Name { get; set; }
///
/// Page Title which is shown in the browser tab.
///
public string Title { get; set; }
///
/// Sort order in the list of other sibling pages
///
public int Order { get; set; }
///
/// Full URL to this page.
/// TODO: verify that this is the case - does it contain domain etc. or just from domain or alias root?
///
public string Url { get; set; }
///
/// Reference to a which will be used to show this page.
///
public string ThemeType { get; set; }
///
/// Reference to a Container which will be used for modules on this page.
///
public string DefaultContainerType { get; set; }
///
/// Content to be included in the head of the page
///
public string HeadContent { get; set; }
///
/// Content to be included in the body of the page
///
public string BodyContent { get; set; }
///
/// Icon file for this page.
/// TODO: unclear what this is for, and what icon library is used. Probably FontAwesome?
///
public string Icon { get; set; }
public bool IsNavigation { get; set; }
public bool IsClickable { get; set; }
public int? UserId { get; set; }
///
/// Start of when this assignment is valid. See also
///
public DateTime? EffectiveDate { get; set; }
///
/// End of when this assignment is valid. See also
///
public DateTime? ExpiryDate { get; set; }
public bool IsPersonalizable { get; set; }
#region IDeletable Properties
public string DeletedBy { get; set; }
public DateTime? DeletedOn { get; set; }
public bool IsDeleted { get; set; }
#endregion
///
/// List of Pane-names which this Page has.
///
[NotMapped]
public List Panes { get; set; }
///
/// List of (CSS, JS) which this page needs to render properly.
///
[NotMapped]
public List Resources { get; set; }
[NotMapped]
public List PermissionList { get; set; }
[NotMapped]
public Dictionary Settings { get; set; }
[NotMapped]
public int Level { get; set; }
///
/// Determines if there are sub-pages. True if this page has sub-pages.
///
[NotMapped]
public bool HasChildren { get; set; }
#region Deprecated Properties
[Obsolete("The EditMode property is deprecated", false)]
[NotMapped]
public bool EditMode { get; set; }
[Obsolete("The LayoutType property is deprecated", false)]
[NotMapped]
public string LayoutType { get; set; }
[Obsolete("The Permissions property is deprecated. Use PermissionList instead", false)]
[NotMapped]
[JsonIgnore] // exclude from API payload
public string Permissions {
get
{
return JsonSerializer.Serialize(PermissionList);
}
set
{
PermissionList = JsonSerializer.Deserialize>(value);
}
}
#endregion
}
}