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

namespace JuSNS.Factory.ApiInterface
{
    /// <summary>
    /// 开发者接口
    /// </summary>
    public interface IDeveloper
    {
        /// <summary>
        /// 申请成为开发者
        /// </summary>
        /// <param name="UserID">用户ID</param>
        /// <returns></returns>
        int RequestDeveloper(int UserID, out int isDev);
        /// <summary>
        /// 是否是开发者
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        bool IsDeveloper(int UserID);
        /// <summary>
        /// 是否开通开发者
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        bool IsEnabled(int UserID);
        /// <summary>
        /// 删除开发者
        /// </summary>
        /// <param name="ID">开发者ID</param>
        /// <returns></returns>
        int DeleteDeveloper(int ID);     
        /// <summary>
        /// 通过开发者
        /// </summary>
        /// <param name="ID">开发者ID</param>
        /// <returns></returns>
        int PassDeveloper(int ID);
        /// <summary>
        /// 建立应用程序
        /// </summary>
        /// <param name="info">应用程序信息</param>
        /// <returns></returns>
        int CreateApp(AppInfo info);
        /// <summary>
        /// 编辑应用程序信息
        /// </summary>
        /// <param name="info">应用程序信息</param>
        /// <returns></returns>
        int EditApp(AppInfo info);

        int EditAppAdmin(AppInfo info);
        /// <summary>
        /// 删除应用
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="appid"></param>
        /// <returns></returns>
        int DeleteApp(int userid, int appid);
        /// <summary>
        /// 关闭开发者
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        int DisableDeveloper(int ID);
        /// <summary>
        /// 生成appkey
        /// </summary>
        /// <param name="AppID"></param>
        /// <returns></returns>
        int ResetAppKey(int AppID);
        /// <summary>
        /// 取得Appkey
        /// </summary>
        /// <param name="AppID"></param>
        /// <returns></returns>
        string GetAppKey(int AppID);
    }
    public sealed partial class DataAccess
    {
        public static IDeveloper CreateDeveloper()
        {
            string className = path + ".ApiInterface.Developer";
            return (IDeveloper)Assembly.Load(path).CreateInstance(className);
        }
    }
}
