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

namespace JuSNS.Factory
{
    /// <summary>
    /// 投票选项类接口
    /// </summary>
    public interface IVoteOption
    {
        /// <summary>
        /// 添加投票选项
        /// </summary>
        /// <param name="Info">投票选项实体类</param>
        /// <returns>添加成功返回1</returns>
        int Add(VoteOptionInfo Info);

        /// <summary>
        /// 添加投票选项被选次数
        /// </summary>
        /// <param name="ID">投票选项编号</param>
        /// <returns>添加成功返回1</returns>
        int AddCnt(int ID);

        /// <summary>
        /// 投票选项信息
        /// </summary>
        /// <param name="ID">投票选项编号</param>
        /// <returns>返回投票选项实体类</returns>
        VoteOptionInfo Info(int ID);

        /// <summary>
        /// 选项列表
        /// </summary>
        /// <param name="VoteID">投票编号</param>
        /// <returns>返回列表</returns>
        List<VoteOptionInfo> OptionList(int VoteID);

        /// <summary>
        /// 取得用户投票选项
        /// </summary>
        /// <param name="VoteID">投票编号</param>
        /// <param name="UserID">用户编号</param>
        /// <param name="tf">如果用户已投票返回true,否则返回false</param>
        /// <returns>返回列表</returns>
        List<VoteOptionInfo> OptionList(int VoteID, int UserID, out bool tf);
    }

    public sealed partial class DataAccess
    {
        public static IVoteOption CreateVoteOption()
        {
            string className = path + ".VoteOption";
            return (IVoteOption)Assembly.Load(path).CreateInstance(className);
        }
    }
}