//-----------------------------------------------------------------------
//
// Copyright (c) aliasvault. All rights reserved.
// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.
//
//-----------------------------------------------------------------------
namespace AliasServerDb;
using Microsoft.AspNetCore.Identity;
///
/// Alias vault user extending IdentityUser with fields for SRP authentication.
///
public class AliasVaultUser : IdentityUser
{
///
/// Gets or sets the SRP identity used for authentication. This is a fixed value (typically a random GUID)
/// that is used for all SRP operations, is set during registration, and never changes.
///
[System.ComponentModel.DataAnnotations.StringLength(255)]
public string? SrpIdentity { get; set; }
///
/// Gets or sets created timestamp.
///
public DateTime CreatedAt { get; set; }
///
/// Gets or sets the timestamp when the user's password was last changed.
///
public DateTime PasswordChangedAt { get; set; }
///
/// Gets or sets a value indicating whether the user is blocked and should not be able to log in.
///
public bool Blocked { get; set; }
///
/// Gets or sets updated timestamp.
///
public DateTime UpdatedAt { get; set; }
///
/// Gets or sets the maximum number of emails for all of user's aliases. 0 means unlimited.
///
public int MaxEmails { get; set; } = 0;
///
/// Gets or sets the maximum age of emails in days. Emails older than this will be deleted. 0 means unlimited.
///
public int MaxEmailAgeDays { get; set; } = 0;
///
/// Gets or sets the date of the user's last activity (login, API call, etc.).
/// Updated automatically on successful authentication events.
///
public DateTime? LastActivityDate { get; set; }
///
/// Gets or sets the total count of emails received by this user across all time.
/// This is a persistent counter that is incremented when emails are received and is never decremented,
/// even when emails are deleted. Used for abuse detection and usage statistics.
///
public int EmailsReceived { get; set; } = 0;
///
/// Gets or sets the collection of vaults.
///
public virtual ICollection Vaults { get; set; } = [];
///
/// Gets or sets the collection of EmailClaims.
///
public virtual ICollection EmailClaims { get; set; } = [];
///
/// Gets or sets the collection of EncryptionKeys.
///
public virtual ICollection EncryptionKeys { get; set; } = [];
}