using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;

using TEAMModelOS.SDK.Context.Attributes.Azure;


namespace TEAMModelOS.SDK.Models
{
    /// <summary>
    /// 问卷调查
    /// </summary>    
    public class Survey : CosmosEntity
    {
        public Survey() {
            pk = "Survey";
            questions = new List<Questions>();
            classes = new List<Classes>();
        }
       
        public string name { get; set; }   //测试问卷名称', // 问卷名称
        public string description { get; set; }   //测试问卷描述', // 问卷描述
        //public string type { get; set; }   //normal', // 问卷类型
        public string school { get; set; }
        public string creatorId { get; set; }
        public int year { get; set; }
        public string progress { get; set; }
        public List<Questions> questions { get; set; }
        public List<string> targetClassIds { get; set; }
        public int stuCount { get; set; }
        public int status { get; set; } // 问卷状态（100：待发布 200：已发布 300：已结束）
        /// <summary>
        /// 发布对象
        /// </summary>
        //[ProtoMember(4)]
        //public List<Target> target { get; set; }

        /// <summary>
        /// 发布模式 0 立即发布 1 定时
        /// </summary>
        public string publishModel { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        public long startTime { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        public long endTime { get; set; }
        public long createTime { get; set; } // 问卷发布时间
        public List<Classes> classes { get; set; }

        //public long sequenceNumber { get; set; }

        public string url { get; set; }
        public string scope { get; set; }

    }
    /*public class Item {
        public string stem { get; set; }
        /// <summary>
        ///  Complete Single Multiple Subjective， Judge判断
        /// </summary>
        //public string type { get; set; }
        public bool required { get; set; }
        public int order { get; set; }
        public string description { get; set; } = null;
        public List<CodeValue> options { get; set; }
        public List<CodeVal> result { get; set; }
    }*/
     public class Questions { 
        public string qid { get; set; }
        public string question { get; set; }
        public List<Options> option { get; set; }
        public string type { get; set; }
        public QuestionResult result { get; set; }

    }
    public class Options { 
        public string code { get; set; }
        public string value { get; set; }
        public Result result { get; set; }
    }
    public class QuestionResult
    {
        public double finish { get; set; }
        public double finishRate { get; set; }
    }
    public class Result { 
        public double count { get; set; }
        public double rate { get; set; }
    }
    public class Classes { 
        public string code { get; set; }
        public string id { get; set; }
        public string name { get; set; }
        public string scope { get; set; }
        public Result result { get; set; }
        public List<StudentInfo> students { get; set; }
        public List<AnswerRate> answers { get; set; }
    }
    public class AnswerRate {
        public string qid { get; set; }
        public double answerRate { get; set; }
        public List<Options> option { get; set; }
    }
    public class StudentInfo {
        public string id { get; set; }
        public string name { get; set; }
        public long finishTime { get; set; }
        public List<AnswerInfo> answers { get; set; }
        public ResultInfo result { get; set; }
    }
    public class ResultInfo
    {
        public double answerRate { get; set; }
    }
    public class AnswerInfo { 
        public string qid { get; set; }
        public string answer { get; set; }
    }
    /*public class CodeVal{
        public string code { get; set; }
        public int value { get; set; }
    }*/
}
