//by JuSNS v1.0系列
//官方站：www.juSNS.com，演示站:www.ju001.com，www.julala.cn
//QQ:655071(技术)，QQ:9170617（客服）
//MSN:simplt@163.com EMail:simplt@163.com
//program design by Simplt.Xie，arjun
//========================================

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

namespace JuSNS.Factory
{
    /// <summary>
    /// 私信接口类
    /// </summary>
    public interface IMail
    {
        /// <summary>
        /// 添加私信
        /// </summary>
        /// <param name="Info">私信实体类</param>
        /// <returns>添加成功返回1</returns>
        int Add(Mailinfo Info);

        /// <summary>
        /// 删除私信
        /// </summary>
        /// <param name="dType">类型,0为发件箱,1为收件箱</param>
        /// <param name="LetterID">私信编号</param>
        /// <returns>删除成功返回1</returns>
        int Del(int dType, int LetterID, int UserID);

        /// <summary>
        /// 回复私信
        /// </summary>
        /// <param name="Info">私信实体类</param>
        /// <returns>回复成功返回1</returns>
        int Reply(Mailinfo Info);

        /// <summary>
        /// 设置收到的信息为已读状态
        /// </summary>
        /// <param name="LetterID">私信编号</param>
        /// <param name="UserID">用户编号</param>
        /// <returns>操作成功返回1</returns>
        int Read(int LetterID, int UserID);

        /// <summary>
        /// 更新通知状态
        /// </summary>
        /// <param name="UserID">会员编号</param>
        void UpdateNoticeMode(int UserID);

        /// <summary>
        /// 取得最新回复内容
        /// </summary>
        /// <param name="LetterID">私信编号</param>
        /// <param name="isMy">是否自已回复的最新内容</param>
        /// <param name="UserID">用户编号</param>
        /// <returns>返回最新回复内容</returns>
        string getNewReContent(int LetterID, bool isMy, int UserID);

        /// <summary>
        /// 取得最新的回复是否被阅读
        /// </summary>
        /// <param name="LetterID">私信编号</param>
        /// <param name="UserID">用户编号</param>
        /// <returns>0为未读，1为已读</returns>
        int getNewReCNT(int LetterID, int UserID);

        /// <summary>
        /// 取得收信箱
        /// </summary>
        /// <param name="UserID">会员编号</param>
        /// <returns>返回收信箱未读邮件记录数</returns>
        int InBoxCount(int UserID);

        /// <summary>
        /// 私信信息
        /// </summary>
        /// <param name="PhotoID">私信编号</param>
        /// <returns>返回私信实体类</returns>
        Mailinfo Info(int ID);
    }

    public sealed partial class DataAccess
    {
        public static IMail CreateMail()
        {
            string className = path + ".Mail";
            return (IMail)Assembly.Load(path).CreateInstance(className);
        }
    }
}
