OneConversorTemplate/OnlyOneAccessTemplate/Models/ModuleConfig.cs
2025-06-08 18:49:54 -03:00

69 lines
3.1 KiB
C#

using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson;
namespace OnlyOneAccessTemplate.Models
{
public class ModuleConfig
{
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
public string Id { get; set; } = string.Empty;
public string ModuleId { get; set; } = string.Empty; // Ex: "footer-message"
public string Name { get; set; } = string.Empty;
public string Url { get; set; } = string.Empty; // URL do endpoint externo
public string RequestBy { get; set; } = string.Empty; // Identificador único
public bool IsActive { get; set; } = true;
public Dictionary<string, string> Headers { get; set; } = new();
public Dictionary<string, object> Parameters { get; set; } = new();
public int CacheMinutes { get; set; } = 5; // Cache do conteúdo
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
public string? JavaScriptUrl { get; set; } // URL do arquivo JS
public string? JavaScriptFunction { get; set; } // Função de inicialização
public string? CssUrl { get; set; } // CSS opcional
public Dictionary<string, string> Assets { get; set; } = new(); // Assets adicionais
// ADICIONAR na classe ModuleConfig existente:
// Configurações de Proxy Dinâmico
public string? ProxyEndpoint { get; set; } // "/api/modules/{moduleId}"
public Dictionary<string, string> ProxyMappings { get; set; } = new(); // endpoint -> moduleUrl
public bool UseProxy { get; set; } = true;
// Configurações de Segurança
public string? ApiKey { get; set; } // Gerado automaticamente
public List<string> AllowedOrigins { get; set; } = new();
public int RateLimitPerMinute { get; set; } = 60;
// Configurações de Menu
public string? MenuTitle { get; set; }
public string? MenuDescription { get; set; }
public string? MenuIcon { get; set; }
public string? MenuCategory { get; set; } = "Conversores";
public int MenuOrder { get; set; } = 0;
public bool ShowInMenu { get; set; } = true;
// Configurações de SEO
public Dictionary<string, string> SeoTitles { get; set; } = new();
public Dictionary<string, string> SeoDescriptions { get; set; } = new();
public Dictionary<string, string> SeoKeywords { get; set; } = new();
// Configurações Técnicas
public string? HealthEndpoint { get; set; } = "/api/converter/health";
public int HealthCheckIntervalMinutes { get; set; } = 5;
public bool AutoStart { get; set; } = true;
public string? Version { get; set; }
public DateTime? LastHealthCheck { get; set; }
public bool IsHealthy { get; set; } = false;
// Metadados do Desenvolvedor
public string? DeveloperName { get; set; }
public string? DeveloperEmail { get; set; }
public string? Repository { get; set; }
public string? Documentation { get; set; }
}
}