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

namespace YGNT.QuestionLibrary.Papers.Dto
{
    /// <summary>
    /// 自动组卷学科设置
    /// </summary>
    public class AutoPaperDisciplineSettingDto
    {
        /// <summary>
        /// 学科id
        /// </summary>
        [Required]
        public int DisciplineId { get; set; }

        /// <summary>
        /// 学科题量设置
        /// </summary>
        [Required]
        public List<AutoPaperTypeSettingDto> AutoPaperTypeSettings { get; set; }

        /// <summary>
        /// 学科总分
        /// </summary>
        [Required]
        public float TotalScore { get; set; }

        /// <summary>
        /// 获取学科总分设置
        /// </summary>
        /// <returns></returns>
        public float GetDisciplineTotalScore()
        {
            return AutoPaperTypeSettings.Select(x => x.Score * x.Count).Sum();
        }
    }
}