using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using e_suite.Nuget.PasswordHasher;

namespace e_suite.API.Common.models;

/// <summary>
/// Used to pass details when trying to establish a user connection to the API.
/// </summary>
public class Login : IPassword
{
    /// <summary>
    /// users registered e-mail address
    /// </summary>
    [JsonPropertyName("email")]
    [DefaultValue("testuser@sun-strategy.com")]
    [Required]
    [EmailAddress]
    [Display(Name = "E-Mail")]
    public string Email { get; set; } = string.Empty;

    /// <summary>
    /// Users password.  Note, this is unencrypted and used only for comparison against the stored hashed password.
    /// </summary>
    [JsonPropertyName("password")]
    [DefaultValue("12345 Same as my luggage")]
    [Display(Name = "Password")]
    [DataType(DataType.Password)]
    public string Password { get; set; } = string.Empty;

    /// <summary>
    /// Authenticator security code.  Compatible with Google Authenticator.
    /// </summary>
    [JsonPropertyName("securityCode")]
    [DefaultValue("")]
    [Display(Name = "Security Code")]
    public string SecurityCode { get; set; } = string.Empty;

    /// <summary>
    /// User has lost their TFA device and needs to start the process of removing the TFA from their account.  An email will be sent to the user with a link to complete the request.
    /// </summary>
    [JsonPropertyName("requestTfaRemoval")]
    [DefaultValue(false)]
    [Display(Name = "Request 2FA Removal")]
    public bool RequestTfaRemoval { get; set; } = false;

    [JsonPropertyName("forgotPassword")]
    [Display(Name = "Forgot Password")]
    [DefaultValue(false)]
    public bool ForgotPassword { get; set; } = false;
}