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

namespace JuSNS.Factory
{
    public interface IGroup
    {
        /// <summary>
        /// 添加新主题
        /// </summary>
        /// <param name="Info">群讨论实体类</param>
        /// <returns>添加成功返回1</returns>
        int Add(GroupDiscussInfo Info);

        /// <summary>
        /// 修改主题信息
        /// </summary>
        /// <param name="Content">内容</param>
        /// <param name="UserID">会员编号</param>
        /// <param name="ID">回复编号</param>
        /// <returns>修改成功返回1</returns>
        int Edit(string Content, int UserID, int ID);

        /// <summary>
        /// 删除(后台)
        /// </summary>
        /// <param name="ID">编号</param>
        /// <returns>删除成功返回1</returns>
        int Del(int ID);

        /// <summary>
        /// 删除(前台)
        /// </summary>
        /// <param name="ID">编号</param>
        /// <param name="UserID">会员编号</param>
        /// <returns>返回影响记录数</returns>
        int Del(int ID, int UserID);

        /// <summary>
        /// 回复主题
        /// </summary>
        /// <param name="Info">群讨论实体类</param>
        /// <returns>回复成功返回1</returns>
        int Replay(GroupDiscussInfo Info);

        /// <summary>
        /// 锁定主题
        /// </summary>
        /// <param name="ID">主题编号</param>
        /// <returns>锁定成功返回1</returns>
        int Lock(int ID);

        /// <summary>
        /// 解锁主题
        /// </summary>
        /// <param name="ID">主题编号</param>
        /// <returns>解锁成功返回1</returns>
        int UnLock(int ID);

        /// <summary>
        /// 置顶主题
        /// </summary>
        /// <param name="ID">主题编号</param>
        /// <returns>置顶成功返回1</returns>
        int Top(int ID);

        /// <summary>
        /// 取消置顶
        /// </summary>
        /// <param name="ID">主题编号</param>
        /// <returns>取消置顶成功返回1</returns>
        int UnTop(int ID);

        /// <summary>
        /// 取得讨论信息
        /// </summary>
        /// <param name="ID">贴子编号</param>
        /// <returns>返回群讨论实体类</returns>
        GroupDiscussInfo Info(int ID);
    }

    public sealed partial class DataAccess
    {
        public static IGroup CreateGroup()
        {
            string className = path + ".Group";
            return (IGroup)Assembly.Load(path).CreateInstance(className);
        }
    }
}
