using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; namespace Oqtane.Models { /// /// Describes a Site in a in an Oqtane installation. /// Sites can have multiple es. /// public class Site : ModelBase, IDeletable { /// /// The ID of the Site /// public int SiteId { get; set; } /// /// Reference to the the Site is in /// public int TenantId { get; set; } /// /// The site Name /// public string Name { get; set; } /// /// Reference to a which has the Logo for this site. /// Should be an image. /// The theme can then use this where needed. /// public int? LogoFileId { get; set; } /// /// Reference to a which has the FavIcon for this site. /// Should be an image. /// The theme can then use this where needed. /// public int? FaviconFileId { get; set; } /// /// Default theme for the site /// public string DefaultThemeType { get; set; } /// /// Default container for the site /// public string DefaultContainerType { get; set; } /// /// Default admin container /// public string AdminContainerType { get; set; } /// /// Indicates if the site is a progressive web application (PWA) /// public bool PwaIsEnabled { get; set; } /// /// The app icon for the progressive web application (PWA) /// public int? PwaAppIconFileId { get; set; } /// /// The splash icon for the progressive web application (PWA) /// public int? PwaSplashIconFileId { get; set; } /// /// Determines if visitors may register / create user accounts /// public bool AllowRegistration { get; set; } /// /// Determines if site visitors will be recorded /// public bool VisitorTracking { get; set; } /// /// Determines if broken urls (404s) will be captured automatically /// public bool CaptureBrokenUrls { get; set; } /// /// Unique GUID to identify the Site. /// public string SiteGuid { get; set; } /// /// The default render mode for the site ie. Static,Interactive,Headless /// public string RenderMode { get; set; } /// /// The render mode for UI components which require interactivity ie. Server,WebAssembly,Auto /// public string Runtime { get; set; } /// /// If the site supports prerendering (only applies to Interactive rendermode) /// public bool Prerender { get; set; } /// /// Indicates if a site can be integrated with an external .NET MAUI hybrid application /// public bool Hybrid { get; set; } /// /// Keeps track of site configuration changes and is used by the ISiteMigration interface /// public string Version { get; set; } /// /// The home page of the site - the "/" path will be used by default if no home page is specified /// public int? HomePageId { 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; } /// /// Indicates if site is deleted /// public bool IsDeleted { get; set; } /// /// The user who deleted site /// public string DeletedBy { get; set; } /// /// Date site was deleted /// public DateTime? DeletedOn { get; set; } /// /// The allowable iamge file extensions /// [NotMapped] public string ImageFiles { get; set; } /// /// The allowable file extensions which can be uploaded /// [NotMapped] public string UploadableFiles { get; set; } /// /// Used when provisioning a site from a site template /// [NotMapped] public string SiteTemplateType { get; set; } /// /// The settings for the site /// [NotMapped] public Dictionary Settings { get; set; } /// /// List of pages for the site /// [NotMapped] public List Pages { get; set; } /// /// List of languages for the site /// [NotMapped] public List Languages { get; set; } /// /// List of themes for the site /// [NotMapped] public List Themes { get; set; } public Site Clone() { return new Site { SiteId = SiteId, TenantId = TenantId, Name = Name, LogoFileId = LogoFileId, FaviconFileId = FaviconFileId, DefaultThemeType = DefaultThemeType, DefaultContainerType = DefaultContainerType, AdminContainerType = AdminContainerType, PwaIsEnabled = PwaIsEnabled, PwaAppIconFileId = PwaAppIconFileId, PwaSplashIconFileId = PwaSplashIconFileId, AllowRegistration = AllowRegistration, VisitorTracking = VisitorTracking, CaptureBrokenUrls = CaptureBrokenUrls, SiteGuid = SiteGuid, RenderMode = RenderMode, Runtime = Runtime, Prerender = Prerender, Hybrid = Hybrid, Version = Version, HomePageId = HomePageId, HeadContent = HeadContent, BodyContent = BodyContent, IsDeleted = IsDeleted, DeletedBy = DeletedBy, DeletedOn = DeletedOn, ImageFiles = ImageFiles, UploadableFiles = UploadableFiles, SiteTemplateType = SiteTemplateType, CreatedBy = CreatedBy, CreatedOn = CreatedOn, ModifiedBy = ModifiedBy, ModifiedOn = ModifiedOn, Settings = Settings.ToDictionary(setting => setting.Key, setting => setting.Value), Pages = Pages.ConvertAll(page => page.Clone()), Languages = Languages.ConvertAll(language => language.Clone()), Themes = Themes }; } #region Obsolete properties [NotMapped] [Obsolete("This property is deprecated.", false)] public string DefaultLayoutType { get; set; } #endregion } }