using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using New_College.IServices;
using New_College.Model;
using New_College.Model.ViewModels.Query;
using New_College.Model.ViewModels.Result;

namespace New_College.Api.Controllers.Front
{
    [Route("api/[controller]")]
    [ApiController]
    public class EvaluationsController : ControllerBase
    {

        private readonly ITest_PsychMeasurementInfoServices _test_Psych;
        public EvaluationsController(ITest_PsychMeasurementInfoServices _PsychMeasurementInfoServices)
        {
            this._test_Psych = _PsychMeasurementInfoServices;
        }

        /// <summary>
        /// 测评结果列表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<MessageModel<List<EvaluationResponse>>> GetEvaluations([FromQuery] EvaluationRequest request)
        {
            try
            {
                var result = await this._test_Psych.GetEvaluations(request);
                return new MessageModel<List<EvaluationResponse>>()
                {
                    msg = "success",
                    response = result,
                    success = true
                };
            }
            catch (Exception ex)
            {

                return new MessageModel<List<EvaluationResponse>>()
                {
                    msg = ex.Message
                };
            }
        }

    }
}
