using System;
using Hncore.Pass.BaseInfo.Models;

namespace Hncore.Pass.BaseInfo.Response
{
    public class LoginResponse
    {
        public string Token { get; set; }
        
        public LoginManagerResponse Manager { get; set; }
    }
    public class LoginManagerResponse
    {
        public System.Int32 ID { get; set; }
        public System.DateTime CreateTime { get; set; }
        public System.DateTime UpdateTime { get; set; }
        public System.Int32 DeleteTag { get; set; }
        public System.Int32 TenantId { get; set; }
        public System.Int32 Updatorid { get; set; }
        public System.Int32 Creatorid { get; set; }

        /// <summary>
        /// 登录名
        /// </summary>
        public System.String Logincode { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        ///public System.String Password { get; set; }
        /// <summary>
        /// 员工id
        /// </summary>
        public System.Int32 Workerid { get; set; }

        /// <summary>
        /// 角色id
        /// </summary>
        public System.Int32 Roleid { get; set; }
        /// <summary>
        /// 状态 （枚举： ManagerState）
        /// </summary>
        //public System.Int32 State { get; set; }

        /// <summary>
        /// 头像路径
        /// </summary>
        public System.String Photourl { get; set; }


        /// <summary>
        /// 角色名称
        /// </summary>
        public string RoleName { get; set; }


        /// <summary>
        /// 员工姓名
        /// </summary>
        public string WorkerName { get; set; }

        /// <summary>
        /// 员工方式
        /// </summary>
        public string WorkerMobile { get; set; }

        /// <summary>
        /// 关联的楼宇数量
        /// </summary>
        public int BuildingCount { get; set; }

        /// <summary>
        /// 微信openid[50]
        /// </summary>
        public string Wxopenid { get; set; }

        /// <summary>
        /// 部门名称
        /// </summary>
        public string DepartmentName { get; set; }

        /// <summary>
        /// 微信昵称
        /// </summary>
        public string Wxnickname { get; set; }

        public System.String PropertyCompanyName { get; set; }

        /// <summary>
        /// 真实姓名
        /// </summary>
        public string RealName { get; set; }

        /// <summary>
        /// 电子邮箱
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        /// 管理员手机号
        /// </summary>
        public string Phone { get; set; }


        /// <summary>
        /// 应用编码（有值为单一应用，无值为混合应用）
        /// </summary>
        public string AppCode { get; set; }

        /// <summary>
        /// 过期时间
        /// </summary>
        public DateTime ExpiredTime { get; set; }

        /// <summary>
        /// 系统有效期
        /// </summary>
        public int ValidDays { get; set; }

        /// <summary>
        /// 是否是超级管理员
        /// </summary>
        public bool IsRootUser { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        public int? Sex { get; set; }

        public LoginManagerResponse FromEntity(Manager manager)
        {
            ID = manager.Id;
            CreateTime = manager.CreateTime;
            UpdateTime = manager.UpdateTime;
            DeleteTag = manager.DeleteTag;
            TenantId = manager.TenantId;
            Updatorid = manager.UpdatorId;
            Creatorid = manager.CreatorId;
            Logincode = manager.LoginCode;
            Workerid =0;
            Roleid = manager.RoleId;
            Photourl = manager.PhotoUrl;
            Wxopenid = manager.WxOpenid;
            Wxnickname = manager.WxNickName;
            RealName = manager.RealName;
            Email = manager.Email;
            Phone = manager.Phone;
            IsRootUser = manager.IsRoot==1;
            return this;
        }
    }

    /// <summary>
    /// 安卓登陆的返回
    /// </summary>
    public class LoginAndroidManagerResponse
    {
        public System.Int32 ID { get; set; }
        public System.Int32 OwnerId { get; set; }
   
        /// <summary>
        /// 登录名
        /// </summary>
        public System.String Logincode { get; set; }
       
        /// <summary>
        /// 头像路径
        /// </summary>
        public System.String Photourl { get; set; }


        /// <summary>
        /// 角色名称
        /// </summary>
        public string RoleName { get; set; }
        

        public System.String PropertyCompanyName { get; set; }

        /// <summary>
        /// 真实姓名
        /// </summary>
        public string RealName { get; set; }

        /// <summary>
        /// 电子邮箱
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        /// 管理员手机号
        /// </summary>
        public string Phone { get; set; }
        
        /// <summary>
        /// 性别
        /// </summary>
        public int? Sex { get; set; }

        public string Logo { get; set; }

        public LoginAndroidManagerResponse FromEntity(Manager manager)
        {
            ID = manager.Id;
            OwnerId = manager.TenantId;
            Logincode = manager.LoginCode;
            Photourl = manager.PhotoUrl;
            RealName = manager.RealName;
            Email = manager.Email;
            Phone = manager.Phone;
            return this;
        }
    }
}