using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TEAMModelOS.Models;
using TEAMModelOS.SDK.DI;

namespace TEAMModelOS.Controllers.Client
{
    [Authorize(Roles = "HiLearning")]
    [Route("hilearning")]
    [ApiController]
    public class HiLearningController : ControllerBase
    {
        private readonly DingDing _dingDing;
        private readonly Option _option;
        public HiLearningController(DingDing dingDing, IOptionsSnapshot<Option> option)
        {
            _dingDing = dingDing;
            _option = option?.Value;
        }

        
        [ProducesResponseType(StatusCodes.Status200OK)]
        [ProducesResponseType(StatusCodes.Status400BadRequest)]
        [ProducesDefaultResponseType]
        [HttpPost("init")]
        public async Task<IActionResult> Init()
        {
            try
            {

            }
            catch (Exception ex)
            {
                await _dingDing.SendBotMsg($"CoreAPI2，{_option.Location}，Channel/Create()\n{ex.Message}", GroupNames.醍摩豆服務運維群組);
                return BadRequest();
            }
            return Ok();
        }
    }
}
