using Edu.Common;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Mall;
using Edu.Model.ViewModel.User;
using System;
using System.Collections.Generic;

namespace Edu.Model.ViewModel.Course
{
    /// <summary>
    /// 课程视图实体类
    /// </summary>
    [Serializable]
    public class RB_Course_ViewModel : Model.Entity.Course.RB_Course
    {
        /// <summary>
        /// 创建人
        /// </summary>
        public string CreateByName { get; set; }

        /// <summary>
        /// 修改人
        /// </summary>
        public string UpdateByName { get; set; }

        /// <summary>
        /// 创建时间字符串
        /// </summary>
        public string CreateTimeStr { get { return this.CreateTime.FormatTime(); } }

        /// <summary>
        /// 更新时间
        /// </summary>
        public string UpdateTimeStr { get { return this.UpdateTime.FormatTime(); } }

        /// <summary>
        /// 分类名称
        /// </summary>
        public string CateName { get; set; }

        /// <summary>
        /// 分类编号【查询使用】
        /// </summary>
        public string QCateIds { get; set; }

        /// <summary>
        /// 课程编号
        /// </summary>
        public string QCourseIds { get; set; }

        /// <summary>
        /// 是否查询优化价格
        /// </summary>
        public int IsQPrice { get; set; }

        /// <summary>
        /// 是否查询老师
        /// </summary>
        public int IsQTeacher { get; set; }

        /// <summary>
        /// 课程阶梯价格列表
        /// </summary>
        public List<RB_Course_StepPrice_ViewModel> StepPriceList { get; set; }

        /// <summary>
        /// 课程优惠列表
        /// </summary>
        public List<RB_Course_Preferential_Extend> PreferentialList { get; set; }

        /// <summary>
        /// 讲师列表
        /// </summary>
        public List<RB_Teacher_ViewModel> TeacherList { get; set; }

        /// <summary>
        /// 教师团队
        /// </summary>
        public List<int> TeacherIdList
        {
            get
            {
                if (!string.IsNullOrEmpty(this.Teacher_Ids))
                {
                    return Common.ConvertHelper.StringToList(this.Teacher_Ids);
                }
                return new List<int>();
            }
        }

        /// <summary>
        /// 销售平台[修改使用]
        /// </summary>
        public List<int> SalePlatList
        {
            get
            {
                if (!string.IsNullOrEmpty(this.Saleplat))
                {
                    return Common.ConvertHelper.StringToList(this.Saleplat);
                }
                return new List<int>();
            }
        }

        /// <summary>
        /// 销售平台数组
        /// </summary>
        public List<string> SalePlatArr
        {
            get
            {
                List<string> list = new List<string>();
                if (this.SalePlatList != null && this.SalePlatList.Count > 0)
                {
                    foreach (var item in this.SalePlatList)
                    {
                        switch (item)
                        {
                            case 1:
                                list.Add("内部销售");
                                break;
                            case 2:
                                list.Add("学员App");
                                break;
                            case 3:
                                list.Add("网课端");
                                break;
                        }
                    }
                }
                return list;
            }
        }

        /// <summary>
        /// 是否取随机条数
        /// </summary>
        public bool IsRand { get; set; }

        /// <summary>
        /// 随机条数
        /// </summary>
        public int RandNum { get; set; }

        /// <summary>
        /// 单元数量
        /// </summary>
        public int UnitCount { get; set; }

        /// <summary>
        /// 章节数量
        /// </summary>
        public int ChapterCount { get; set; }


        /// <summary>
        /// 小程序商品分类
        /// </summary>
        public List<RB_Goods_Category_Extend> CategoryList { get; set; }


        /// <summary>
        /// 课程等级
        /// </summary>
        public string CourseRateName { get { return this.CourseRate.ToName(); } }

        /// <summary>
        /// 所属科目名称
        /// </summary>
        public string CourseSubjectName { get; set; }

        #region 滚动开班使用

        /// <summary>
        /// 课程订单数量
        /// </summary>
        public int OrderNum { get; set; }

        /// <summary>
        /// 课程报名人数
        /// </summary>
        public int GuestNum { get; set; }

        /// <summary>
        /// 排序  1订单数量升序  2订单数量降序   3报名人数升序   4报名人数降序
        /// </summary>
        public int Q_OrderBy { get; set; }

        #endregion

        /// <summary>
        /// 是否查询有上架(1-是)
        /// </summary>
        public int IsQuerySalePlat { get; set; }
    }
}