using System.Text.Json; namespace Tiku.Application.Tenancy; public sealed record TenantFrontendConfigDraft( JsonElement Branding, JsonElement Theme, JsonElement Features, JsonElement Navigation, JsonElement HomeModules); public sealed record TenantFrontendConfigItem( int SchemaVersion, int ConfigVersion, TenantFrontendConfigDraft Published, TenantFrontendConfigDraft Draft, DateTimeOffset? PublishedAt); public sealed record TenantRuntimeBootstrap( int SchemaVersion, int ConfigVersion, string TenantCode, string TenantName, JsonElement Branding, JsonElement Theme, JsonElement Features, JsonElement Navigation, JsonElement HomeModules, IReadOnlyCollection EnabledFeatures, IReadOnlyCollection LoginMethods); public interface ITenantFrontendConfigService { Task GetAsync(Guid tenantId, CancellationToken cancellationToken = default); Task SaveDraftAsync( Guid tenantId, TenantFrontendConfigDraft draft, CancellationToken cancellationToken = default); Task PublishAsync( Guid tenantId, int expectedVersion, CancellationToken cancellationToken = default); Task GetRuntimeAsync(Guid tenantId, CancellationToken cancellationToken = default); } public sealed class TenantFrontendConfigException(string code, string message) : Exception(message) { public string Code { get; } = code; }