Files
Core.Thalos.BuildingBlocks/Core.Thalos.BuildingBlocks/Adapters/UserAdapter.cs
2025-06-17 15:10:30 -06:00

123 lines
3.9 KiB
C#

// ***********************************************************************
// <copyright file="UserAdapter.cs">
// AgileWebs
// </copyright>
// ***********************************************************************
using Core.Blueprint.Mongo;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
namespace Core.Thalos.Adapters
{
/// <summary>
/// Adapter representing a user.
/// </summary>
[CollectionAttributeName("Users")]
public class UserAdapter : Document
{
/// <summary>
/// Gets or sets the guid of the user.
/// </summary>
[BsonElement("guid")]
[BsonRepresentation(BsonType.String)]
[JsonPropertyName("guid")]
public string? Guid { get; set; }
/// <summary>
/// Gets or sets the email address of the user.
/// </summary>
[BsonElement("email")]
[BsonRepresentation(BsonType.String)]
[JsonPropertyName("email")]
public string Email { get; set; } = null!;
/// <summary>
/// Gets or sets the name of the user.
/// </summary>
[BsonElement("name")]
[BsonRepresentation(BsonType.String)]
[JsonPropertyName("name")]
public string Name { get; set; } = null!;
/// <summary>
/// Gets or sets the middlename of the user.
/// </summary>
[BsonElement("middleName")]
[BsonRepresentation(BsonType.String)]
[JsonPropertyName("middleName")]
public string? MiddleName { get; set; }
/// <summary>
/// Gets or sets the last name of the user.
/// </summary>
[BsonElement("lastName")]
[BsonRepresentation(BsonType.String)]
[JsonPropertyName("lastName")]
public string LastName { get; set; } = null!;
/// <summary>
/// Gets or sets the name of the user.
/// </summary>
[BsonElement("displayName")]
[BsonRepresentation(BsonType.String)]
[JsonPropertyName("displayName")]
public string? DisplayName { get; set; }
/// <summary>
/// Gets or sets the role ID of the user.
/// </summary>
[BsonElement("roleId")]
[BsonRepresentation(BsonType.ObjectId)]
[JsonPropertyName("roleId")]
public string RoleId { get; set; } = null!;
/// <summary>
/// Gets or sets the array of companies associated with the user.
/// </summary>
[BsonElement("companies")]
[JsonPropertyName("companies")]
public string[] Companies { get; set; } = null!;
/// <summary>
/// Gets or sets the array of projects associated with the user.
/// </summary>
[BsonElement("projects")]
[JsonPropertyName("projects")]
public string[]? Projects { get; set; }
/// <summary>
/// Gets or sets the boolean of the consent form accepted by the user.
/// </summary>
[BsonElement("consentFormAccepted")]
[JsonPropertyName("consentFormAccepted")]
[BsonIgnoreIfNull]
public bool ConsentFormAccepted { get; set; }
/// <summary>
/// Gets or sets the timestamp of the last login of the user.
/// </summary>
[BsonElement("lastLogIn")]
[BsonRepresentation(BsonType.DateTime)]
[JsonPropertyName("lastLogIn")]
public DateTime? LastLogIn { get; set; }
/// <summary>
/// Gets or sets the timestamp of the last logout of the user.
/// </summary>
[BsonElement("lastLogOut")]
[BsonRepresentation(BsonType.DateTime)]
[JsonPropertyName("lastLogOut")]
public DateTime? LastLogOut { get; set; }
/// <summary>
/// Gets or sets the token associated with the user.
/// </summary>
[BsonElement("token")]
[BsonRepresentation(BsonType.String)]
[JsonPropertyName("token")]
public string? Token { get; set; } = null;
}
}