// ***********************************************************************
// 
//     AgileWebs
// 
// ***********************************************************************
using Core.Cerberos.Adapters.Common.Enums;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
namespace Core.Cerberos.Adapters
{
    /// 
    /// Adapter representing a user.
    /// 
    public class UserAdapter : BaseAdapterResponse
    {
        /// 
        /// Gets or sets the unique identifier of the user.
        /// 
        [BsonId]
        [BsonElement("_id")]
        [BsonRepresentation(BsonType.ObjectId)]
        [JsonPropertyName("id")]
        public string Id { get; set; } = null!;
        /// 
        /// Gets or sets the guid of the user.
        /// 
        [BsonElement("guid")]
        [BsonRepresentation(BsonType.String)]
        [JsonPropertyName("guid")]
        public string? Guid { get; set; }
        /// 
        /// Gets or sets the email address of the user.
        /// 
        [BsonElement("email")]
        [BsonRepresentation(BsonType.String)]
        [JsonPropertyName("email")]
        public string Email { get; set; } = null!;
        /// 
        /// Gets or sets the name of the user.
        /// 
        [BsonElement("name")]
        [BsonRepresentation(BsonType.String)]
        [JsonPropertyName("name")]
        public string Name { get; set; } = null!;
        /// 
        /// Gets or sets the middlename of the user.
        /// 
        [BsonElement("middleName")]
        [BsonRepresentation(BsonType.String)]
        [JsonPropertyName("middleName")]
        public string? MiddleName { get; set; }
        /// 
        /// Gets or sets the last name of the user.
        /// 
        [BsonElement("lastName")]
        [BsonRepresentation(BsonType.String)]
        [JsonPropertyName("lastName")]
        public string LastName { get; set; } = null!;
        /// 
        /// Gets or sets the name of the user.
        /// 
        [BsonElement("displayName")]
        [BsonRepresentation(BsonType.String)]
        [JsonPropertyName("displayName")]
        public string? DisplayName { get; set; }
        ///     
        /// Gets or sets the role ID of the user.
        /// 
        [BsonElement("roleId")]
        [BsonRepresentation(BsonType.ObjectId)]
        [JsonPropertyName("roleId")]
        public string RoleId { get; set; } = null!;
        /// 
        /// Gets or sets the array of companies associated with the user.
        /// 
        [BsonElement("companies")]
        [JsonPropertyName("companies")]
        public string[] Companies { get; set; } = null!;
        /// 
        /// Gets or sets the array of projects associated with the user.
        /// 
        [BsonElement("projects")]
        [JsonPropertyName("projects")]
        public string[]? Projects { get; set; }
        /// 
        /// Gets or sets the boolean of the consent form accepted by the user.
        /// 
        [BsonElement("consentFormAccepted")]
        [JsonPropertyName("consentFormAccepted")]
        [BsonIgnoreIfNull]
        public bool ConsentFormAccepted { get; set; }
        /// 
        /// Gets or sets the timestamp of the last login of the user.
        /// 
        [BsonElement("lastLogIn")]
        [BsonRepresentation(BsonType.DateTime)]
        [JsonPropertyName("lastLogIn")]
        public DateTime? LastLogIn { get; set; }
        /// 
        /// Gets or sets the timestamp of the last logout of the user.
        /// 
        [BsonElement("lastLogOut")]
        [BsonRepresentation(BsonType.DateTime)]
        [JsonPropertyName("lastLogOut")]
        public DateTime? LastLogOut { get; set; }
        /// 
        /// Gets or sets the token associated with the user.
        /// 
        [BsonElement("token")]
        [BsonRepresentation(BsonType.String)]
        [JsonPropertyName("token")]
        public string? Token { 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;
    }
}