using BBWY.Server.Business;
using BBWY.Server.Model.Db;
using Microsoft.AspNetCore.Mvc;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace JD.API.Controllers
{
    [Produces("application/json")]
    [Route("Api/[Controller]/[Action]")]
    [ApiController]
    public class YunDingController : ControllerBase
    {
        private APIExecutionTimesRecorder apiExecutionTimesRecorder;
        private YunDingBusiness yunDingBusiness;
        public YunDingController(YunDingBusiness yunDingBusiness, APIExecutionTimesRecorder apiExecutionTimesRecorder)
        {
            this.yunDingBusiness = yunDingBusiness;
            this.apiExecutionTimesRecorder = apiExecutionTimesRecorder;
        }

        [HttpGet]
        public void RefreshKey()
        {
            yunDingBusiness.RefreshKey();
        }

        [HttpPost]
        public void ApiExecutionTimesFlush()
        {
            apiExecutionTimesRecorder.Flush();
        }
    }
}