using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace YBDevice.NApi.Application.ThirdClient
{
    /// <summary>
    /// 家庭成员信息修改
    /// </summary>
    public class FamilySubmitC2SDto:BaseInfo,IValidatableObject
    {
        /// <summary>
        /// 主键,有则是修改
        /// </summary>
        public Guid? Id { get; set; }

        /// <summary>
        /// 用户昵称
        /// </summary>
        [Required(ErrorMessage ="昵称不可为空"),MaxLength(100,ErrorMessage ="昵称最多100个字")]
        public string Name { get; set; }

        /// <summary>
        /// 性别,1-男,2-女
        /// </summary>
        public int Sex { get; set; }
        /// <summary>
        /// 出生年月
        /// </summary>
        public DateTime Birthday { get; set; }

        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            if(Birthday.Date > DateTime.Now.Date)
            {
                yield return new ValidationResult("出生年月不可大于今天", new string[] { nameof(Birthday) });
            }
        }
    }

    /// <summary>
    /// 家庭成员信息
    /// </summary>
    public class FamilyInfoS2CDto
    {
        /// <summary>
        /// 主键
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        /// 用户昵称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 头像
        /// </summary>
        public string HeadImg { get; set; }

        /// <summary>
        /// 性别,1-男,2-女
        /// </summary>
        public int Sex { get; set; }
        /// <summary>
        /// 出生年月
        /// </summary>
        public DateTime? Birthday { get; set; }
        /// <summary>
        /// 年龄
        /// </summary>
        public string Age { get; set; }
    }
}
