namespace Exam.Infrastructure.Validation.Validation
{
    /// <summary>
    /// 验证错误明细
    /// </summary>
    public class ValidationErrorItem
    {
        public ValidationErrorItem(string propertyName, string errorMessage, object attemptedValue, bool customState, string errorKey = "")
        {
            PropertyName = propertyName;
            ErrorMessage = errorMessage;
            AttemptedValue = attemptedValue;
            CustomState = customState;
            ErrorKey = errorKey;
        }

        /// <summary>
        /// 属性名称.
        /// </summary>
        public string PropertyName { get; set; }

        /// <summary>
        /// 错误信息
        /// </summary>
        public string ErrorMessage { get; private set; }

        /// <summary>
        /// 尝试值
        /// </summary>
        public object AttemptedValue { get; private set; }

        /// <summary>
        /// 客户端状态.
        /// </summary>
        public bool CustomState { get; set; }

        /// <summary>
        /// 错误类型
        /// </summary>
        public string ErrorType { get; set; }

        /// <summary>
        /// 错误关键字
        /// </summary>
        public string ErrorKey { get; set; }

        /// <summary>
        /// 错误代码
        /// </summary>
        public string ErrorCode { get; private set; }
    }
}