// *********************************************************************** // // Heath // // *********************************************************************** using Core.Cerberos.Adapters.Common.Enums; using MongoDB.Bson; using MongoDB.Bson.Serialization.Attributes; using System.Text.Json.Serialization; namespace Core.Cerberos.Adapters { /// /// Adapter for representing a module. /// public class ModuleAdapter { /// /// Gets or sets the ID of the module. /// [BsonId] [BsonElement("_id")] [BsonRepresentation(BsonType.ObjectId)] [JsonPropertyName("id")] public string Id { get; set; } = null!; /// /// Gets or sets the name of the module. /// [BsonElement("name")] [BsonRepresentation(BsonType.String)] [JsonPropertyName("name")] public string Name { get; set; } = null!; /// /// Gets or sets the description of the module. /// [BsonElement("description")] [BsonRepresentation(BsonType.String)] [JsonPropertyName("description")] public string? Description { get; set; } /// /// Gets or sets the description of the module. /// [BsonElement("icon")] [BsonRepresentation(BsonType.String)] [JsonPropertyName("icon")] public string? Icon { get; set; } /// /// Gets or sets the description of the module. /// [BsonElement("route")] [BsonRepresentation(BsonType.String)] [JsonPropertyName("route")] public string Route { get; set; } = null!; /// /// Gets or sets the order of the module. /// [BsonElement("order")] [BsonRepresentation(BsonType.Int32)] [JsonPropertyName("order")] public int? Order { get; set; } /// /// Gets or sets the application of the module. /// [BsonElement("application")] [BsonRepresentation(BsonType.String)] [JsonPropertyName("application")] [JsonConverter(typeof(JsonStringEnumConverter))] public ApplicationsEnum? Application { get; set; } = null!; /// /// Gets or sets the date and time when the module was created. /// [BsonElement("createdAt")] [BsonRepresentation(BsonType.DateTime)] [JsonPropertyName("createdAt")] public DateTime CreatedAt { get; set; } = DateTime.UtcNow; /// /// Gets or sets the user who created the module. /// [BsonElement("createdBy")] [BsonRepresentation(BsonType.String)] [JsonPropertyName("createdBy")] public string? CreatedBy { get; set; } /// /// Gets or sets the date and time when the module was last updated. /// [BsonElement("updatedAt")] [BsonRepresentation(BsonType.DateTime)] [JsonPropertyName("updatedAt")] public DateTime? UpdatedAt { get; set; } = null; /// /// Gets or sets the user who last updated the module. /// [BsonElement("updatedBy")] [BsonRepresentation(BsonType.String)] [JsonPropertyName("updatedBy")] public string? UpdatedBy { get; set; } = null; /// /// Gets or sets the status of the module. /// [BsonElement("status")] [BsonRepresentation(BsonType.String)] [JsonPropertyName("status")] [JsonConverter(typeof(JsonStringEnumConverter))] public StatusEnum Status { get; set; } = StatusEnum.Active; } }