// ***********************************************************************
// 
//     AgileWebs
// 
// ***********************************************************************
using Core.Cerberos.Adapters.Common.Constants;
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 permission.
    /// 
    public class PermissionAdapter
    {
        /// 
        /// Gets or sets the ID of the entity.
        /// 
        [BsonId]
        [BsonElement("_id")]
        [BsonRepresentation(BsonType.ObjectId)]
        [JsonPropertyName("id")]
        public string Id { get; set; } = null!;
        /// 
        /// Gets or sets the name of the entity.
        /// 
        [BsonElement("name")]
        [BsonRepresentation(BsonType.String)]
        [JsonPropertyName("name")]
        public string Name { get; set; } = null!;
        /// 
        /// Gets or sets the description of the entity.
        /// 
        [BsonElement("description")]
        [BsonRepresentation(BsonType.String)]
        [JsonPropertyName("description")]
        public string? Description { get; set; }
        /// 
        /// Gets or sets the status of the entity object.
        /// 
        [BsonElement("accessLevel")]
        [BsonRepresentation(BsonType.String)]
        [JsonPropertyName("accessLevel")]
        [JsonConverter(typeof(JsonStringEnumConverter))]
        public AccessLevelEnum? AccessLevel { get; set; } = null!;
        /// 
        /// Gets or sets the date and time when the entity was created.
        /// 
        [BsonElement("createdAt")]
        [BsonRepresentation(BsonType.DateTime)]
        [JsonPropertyName("createdAt")]
        public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
        /// 
        /// Gets or sets the user who created the entity.
        /// 
        [BsonElement("createdBy")]
        [BsonRepresentation(BsonType.String)]
        [JsonPropertyName("createdBy")]
        public string? CreatedBy { get; set; }
        /// 
        /// Gets or sets the date and time when the entity 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 entity.
        /// 
        [BsonElement("updatedBy")]
        [BsonRepresentation(BsonType.String)]
        [JsonPropertyName("updatedBy")]
        public string? UpdatedBy { get; set; } = null;
        /// 
        /// Gets or sets the status of the entity.
        /// 
        [BsonElement("status")]
        [BsonRepresentation(BsonType.String)]
        [JsonPropertyName("status")]
        [JsonConverter(typeof(JsonStringEnumConverter))]
        public StatusEnum Status { get; set; } = StatusEnum.Active;
    }
}