using System; using System.Collections.Generic; namespace zero.Core.Options { public class ZeroOptions : IZeroOptions { public ZeroOptions() { SupportedLanguages = new string[2] { "en-US", "de-DE" }; DefaultLanguage = SupportedLanguages[0]; TokenExpiration = 60; BackofficePath = "/zero"; ExcludedPaths = new List() { }; Raven = new RavenOptions() { CollectionPrefix = String.Empty }; Sections = new SectionOptions(); Features = new FeatureOptions(); Pages = new PageOptions(); Modules = new ModuleOptions(); Permissions = new PermissionOptions(); Settings = new SettingsOptions(); Spaces = new SpaceOptions(); Integrations = new IntegrationOptions(); } /// public bool SetupCompleted => !String.IsNullOrEmpty(Raven?.Database); /// public string ZeroVersion { get; set; } /// public string DefaultLanguage { get; set; } /// public string[] SupportedLanguages { get; private set; } /// public int TokenExpiration { get; set; } /// public RavenOptions Raven { get; set; } /// public string BackofficePath { get; set; } /// /// Paths in the backoffice which are not handled by zero /// public List ExcludedPaths { get; private set; } /// //public IZeroPluginConfiguration Backoffice { get; set; } /// public SectionOptions Sections { get; private set; } /// public FeatureOptions Features { get; private set; } /// public PageOptions Pages { get; private set; } /// public ModuleOptions Modules { get; private set; } /// public PermissionOptions Permissions { get; private set; } /// public SettingsOptions Settings { get; private set; } /// public SpaceOptions Spaces { get; private set; } /// public IntegrationOptions Integrations { get; private set; } } public class RavenOptions { public string Url { get; set; } public string Database { get; set; } public string CollectionPrefix { get; set; } } public interface IZeroOptions { /// /// Whether the zero setup has already been completed and the instance is ready for use /// bool SetupCompleted { get; } /// /// The currently active version /// This should not be set manually, as it is used for setup and migrations and incremented automatically /// string ZeroVersion { get; set; } /// /// Default language ISO code /// string DefaultLanguage { get; set; } /// /// Language ISO codes which are supported by the zero backoffice /// string[] SupportedLanguages { get; } /// /// Expiration in minutes of a generated change token for an entity /// int TokenExpiration { get; set; } /// /// RavenDB configuration data /// RavenOptions Raven { get; set; } /// /// URL path to the backoffice (defaults to /zero) /// string BackofficePath { get; set; } /// /// Paths in the backoffice which are not handled by zero /// List ExcludedPaths { get; } /// /// /// SectionOptions Sections { get; } /// /// /// FeatureOptions Features { get; } /// /// /// PageOptions Pages { get; } /// /// /// ModuleOptions Modules { get; } /// /// /// PermissionOptions Permissions { get; } /// /// /// SettingsOptions Settings { get; } /// /// /// SpaceOptions Spaces { get; } /// /// /// IntegrationOptions Integrations { get; } } }