using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using JuSNS.Model.ApiInterface;

namespace JuSNS.Factory.ApiInterface
{
    /// <summary>
    /// Api用户接口
    /// </summary>
    public interface IApiUser
    {
        /// <summary>
        /// 取得字段属性
        /// </summary>
        /// <param name="Field">字段名称</param>
        /// <param name="UserID">用户ID</param>
        /// <returns></returns>
        string GetProperty(int UserID,string Field);
        /// <summary>
        /// 取得所有的字段属性
        /// </summary>
        /// <param name="Fields">字段名称</param>
        /// <param name="UserID">用户ID</param>
        /// <returns></returns>
        Dictionary<string, string> GetAllProperty(int UserID,string[] Fields);
        /// <summary>
        /// 是否有这个字段
        /// </summary>
        /// <param name="Field">字段名称</param>
        /// <returns></returns>
        bool HasField(string Field);
        /// <summary>
        /// 取得所有字段名称
        /// </summary>
        /// <returns></returns>
        string[] GetFields();
        /// <summary>
        /// 设置某个字段的值
        /// </summary>
        /// <param name="UserID">用户ID</param>
        /// <param name="Field"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        int SetField(int UserID,string Field, object value);
        /// <summary>
        /// 某个字段是否可写
        /// </summary>
        /// <param name="Field">字段名称</param>
        /// <returns></returns>
        bool CanWrite(string Field);
        /// <summary>
        /// 是否添加某个应用
        /// </summary>
        /// <param name="UserID"></param>
        /// <param name="AppID"></param>
        /// <returns></returns>
        bool IsAppAdded(int UserID, int AppID);
        /// <summary>
        /// 取得头像
        /// </summary>
        /// <param name="UserID">用户ID</param>
        /// <returns></returns>
        string GetHeadImg(int UserID);
        /// <summary>
        /// 用户ID是否存在
        /// </summary>
        /// <param name="UserID">用户ID</param>
        /// <returns></returns>
        bool ExistUserID(int UserID);
        /// <summary>
        /// 存在Email
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        bool ExistEmail(string email);   
    }
    public sealed partial class DataAccess
    {
        public static IApiUser CreateApiUser()
        {
            string className = path + ".ApiInterface.ApiUser";
            return (IApiUser)Assembly.Load(path).CreateInstance(className);
        }
    }
}
