using Core.Abstractions.Models;
using Core.Enumerations;
using System.ComponentModel.DataAnnotations;

namespace WeatherForecast.Models.Account.Requests {

  /// <summary>
  /// 
  /// </summary>
  public class PasswordChangeRequestModel : RequestModelBase {

    /// <summary>
    /// 
    /// </summary>
    public string? OldPassword { get; set; }

    /// <summary>
    /// 
    /// </summary>
    public string? NewPassword { get; set; }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="validationContext"></param>
    /// <returns></returns>
    public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext) {
      if (string.IsNullOrWhiteSpace(OldPassword))
        yield return new ValidationResult($"{nameof(OldPassword)} ${Errors.NullOrEmpty}");

      if (string.IsNullOrWhiteSpace(NewPassword))
        yield return new ValidationResult($"{nameof(NewPassword)} ${Errors.NullOrEmpty}");
    }
  }
}
