//----------------------------------------------------------------------- // // Copyright (c) aliasvault. All rights reserved. // Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information. // //----------------------------------------------------------------------- namespace AliasVault.Client.Main.Models; using System; using System.ComponentModel.DataAnnotations; using AliasClientDb; using AliasVault.Client.Resources; /// /// Credential edit model. /// public sealed class TotpCodeEdit { /// /// Gets or sets the Id of the TOTP code. /// public Guid Id { get; set; } /// /// Gets or sets the name of the TOTP code. /// public string? Name { get; set; } /// /// Gets or sets the secret key of the TOTP code. /// [Required(ErrorMessageResourceType = typeof(ValidationMessages), ErrorMessageResourceName = nameof(ValidationMessages.SecretKeyRequired))] public string SecretKey { get; set; } = string.Empty; /// /// Gets or sets the created at date of the TOTP code. /// public DateTime CreatedAt { get; set; } /// /// Gets or sets the updated at date of the TOTP code. /// public DateTime UpdatedAt { get; set; } /// /// Gets or sets a value indicating whether the TOTP code is deleted. /// public bool IsDeleted { get; set; } /// /// Converts the edit model to a TotpCode entity. /// /// The TotpCode entity. public TotpCode ToEntity() { return new TotpCode { Id = Id, Name = Name ?? string.Empty, SecretKey = SecretKey, CreatedAt = DateTime.UtcNow, UpdatedAt = DateTime.UtcNow, IsDeleted = IsDeleted, }; } }