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

namespace JuSNS.Factory.ApiInterface
{
    /// <summary>
    /// Api类接口
    /// </summary>
    public interface IApp
    {
        /// <summary>
        /// 锁定应用程序
        /// </summary>
        /// <param name="AppID">应用程序ID</param>
        /// <returns></returns>
        int Lock(int AppID);
        /// <summary>
        /// 解锁应用程序
        /// </summary>
        /// <param name="AppID">应用程序ID</param>
        /// <returns></returns>
        int UnLock(int AppID);
        /// <summary>
        /// 编辑应用程序
        /// </summary>
        /// <param name="info">应用程序ID</param>
        /// <returns></returns>
        int EditApp(AppInfo info);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="AppID">应用程序ID</param>
        /// <returns></returns>
        int Delete(int AppID);
        /// <summary>
        /// 审核开发者
        /// </summary>
        /// <param name="UserID">用户ID</param>
        /// <returns></returns>
        int VerifyDeveloper(int UserID);
        /// <summary>
        /// 锁定开发者
        /// </summary>
        /// <param name="UserID">用户ID</param>
        /// <returns></returns>
        int LockDeveloper(int UserID);
        /// <summary>
        /// 验证AppKey
        /// </summary>
        /// <param name="key">AppKey</param>
        /// <returns></returns>
        bool VerifyKey(string key, out int AppID);
        /// <summary>
        /// 取得应用程序信息
        /// </summary>
        /// <param name="AppID"></param>
        /// <returns></returns>
        AppInfo GetAppInfo(int AppID);
    }
    public sealed partial class DataAccess
    {
        public static IApp CreateApp()
        {
            string className = path + ".ApiInterface.App";
            return (IApp)Assembly.Load(path).CreateInstance(className);
        }
    }
}
