using System.ComponentModel.DataAnnotations;
using Infrastructure;
using OpenAuth.Repository.Domain;

namespace OpenAuth.App.Request
{
    /// <summary>
    /// 添加或修改用户信息的请求
    /// </summary>
    public  class UpdateUserReq
    {
        /// <summary>
        /// 用户ID
        /// </summary>
        /// <returns></returns>
        public long Id { get; set; }


        /// <summary>
        /// </summary>
        /// <returns></returns>
        [Required(ErrorMessage = "账号肯定不能为空啊~~")]
        public string Account { get; set; }
        
        /// <summary>
        /// </summary>
        /// <returns></returns>
        public string Password { get; set; }


        /// <summary>
        /// 用户姓名
        /// </summary>
        /// <returns></returns>
        [Required(ErrorMessage="姓名不能为空")]
        public string Name { get; set; }


        /// <summary>
        /// </summary>
        /// <returns></returns>
        public int Sex { get; set; }


        /// <summary>
        /// 当前状态
        /// </summary>
        /// <returns></returns>
        public int Status { get; set; }


        public static implicit operator UpdateUserReq(SysUser user)
        {
            return user.MapTo<UpdateUserReq>();
        }

        public static implicit operator SysUser(UpdateUserReq view)
        {
            return view.MapTo<SysUser>();
        }

        public UpdateUserReq()
        {
           
        }
    }
}
