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 Folder in Oqtane
///
public class Folder : ModelBase
{
///
/// ID to identify the folder
///
public int FolderId { get; set; }
///
/// Reference to the .
///
public int SiteId { get; set; }
///
/// Reference to the parent , if it has a parent folder.
///
public int? ParentId { get; set; }
///
/// Folder type - based on FolderTypes
///
public string Type { get; set; }
///
/// Folder name
///
public string Name { get; set; }
///
/// Path to the folder
/// TODO: document from where the path starts
///
public string Path { get; set; }
///
/// Sorting order of the folder
///
public int Order { get; set; }
///
/// List of image sizes which can be generated dynamically from uploaded images (ie. 200x200,x200,200x)
///
public string ImageSizes { get; set; }
///
/// Maximum folder capacity (in bytes)
///
public int Capacity { get; set; }
///
/// Folder is a dependency of the framework and cannot be modified or removed
///
public bool IsSystem { get; set; }
///
/// An HTTP Caching Cache-Control directive
///
public string CacheControl { get; set; }
///
/// Deprecated
/// Note that this property still exists in the database because columns cannot be dropped in SQLite
/// Therefore the property must be retained/mapped even though the framework no longer uses it
///
public bool? IsDeleted { get; set; }
///
/// TODO: todoc what would this contain?
///
[NotMapped]
public List PermissionList { get; set; }
///
/// Folder Depth
/// TODO: todoc Where does this start, so Depth 0 or 1 is where in the file system?
///
[NotMapped]
public int Level { get; set; }
///
/// Information if this folder has sub-items like more or objects
///
[NotMapped]
public bool HasChildren { get; set; }
#region Deprecated Properties
[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
}
}