using Newtonsoft.Json;
using System.Collections.Generic;
namespace PSProxmox.Models
{
///
/// Represents a user in Proxmox VE.
///
public class ProxmoxUser
{
///
/// Gets or sets the user ID.
///
[JsonProperty("userid")]
public string UserID { get; set; }
///
/// Gets or sets the user's first name.
///
[JsonProperty("firstname")]
public string FirstName { get; set; }
///
/// Gets or sets the user's last name.
///
[JsonProperty("lastname")]
public string LastName { get; set; }
///
/// Gets or sets the user's email address.
///
[JsonProperty("email")]
public string Email { get; set; }
///
/// Gets or sets a value indicating whether the user is enabled.
///
[JsonProperty("enable")]
public bool Enabled { get; set; }
///
/// Gets or sets a value indicating whether the user is an administrator.
///
[JsonProperty("isadmin")]
public bool IsAdmin { get; set; }
///
/// Gets or sets the user's comment.
///
[JsonProperty("comment")]
public string Comment { get; set; }
///
/// Gets or sets the user's expiration date.
///
[JsonProperty("expire")]
public long Expire { get; set; }
///
/// Gets or sets the user's groups.
///
[JsonProperty("groups")]
public List Groups { get; set; }
///
/// Gets or sets the user's realm.
///
[JsonProperty("realm")]
public string Realm { get; set; }
///
/// Gets the user's full name.
///
[JsonIgnore]
public string FullName => $"{FirstName} {LastName}".Trim();
///
/// Gets the user's username.
///
[JsonIgnore]
public string Username => UserID?.Split('@')[0];
///
/// Gets a value indicating whether the user has expired.
///
[JsonIgnore]
public bool HasExpired => Expire > 0 && Expire < System.DateTimeOffset.UtcNow.ToUnixTimeSeconds();
}
}