using Microsoft.AspNetCore.Mvc;
using Nirvana.Common.ApiBase;
using YBDevice.NApi.Application.LXBodyInfo;

namespace YBDevice.NApi.Controllers.Api
{
    /// <summary>
    /// 丽秀体质接口
    /// </summary>
    public class LXBodyController : BaseController
    {
        private readonly ILXBodyService _lXBodyService;
        public LXBodyController(ILXBodyService lXBodyService)
        {
            _lXBodyService = lXBodyService;
        }

        /// <summary>
        /// 问答列表
        /// </summary>
        /// <param name="familyid">家庭成员ID</param>
        /// <param name="isrestart">是否重新计算,0-否,1-是</param>
        /// <param name="sex">性别,1-男,2-女,0-未知</param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ResultInfo> GetListAsync(int familyid=0,int isrestart = 0,int sex=0)
        {
            return await _lXBodyService.GetListAsync(familyid,isrestart,sex);
        }
        /// <summary>
        /// 全部提交结果计算
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultInfo> GetResultInfoAsync([FromBody] LxBodySumitC2SDto data)
        {
            return await _lXBodyService.GetResultInfoAsync(data);
        }


        /// <summary>
        /// 获取已经计算的结果
        /// </summary>
        /// <param name="familyid">家庭成员ID</param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ResultInfo> GetInfoAsync(int familyid=0)
        {
            return await _lXBodyService.GetInfoAsync(familyid);
        }
    }
}
