using System;
using MediaBrowser.Model.SyncPlay;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Jellyfin.Api.Controllers
{
    /// 
    /// The time sync controller.
    /// 
    [Route("")]
    public class TimeSyncController : BaseJellyfinApiController
    {
        /// 
        /// Gets the current UTC time.
        /// 
        /// Time returned.
        /// An  to sync the client and server time.
        [HttpGet("GetUtcTime")]
        [ProducesResponseType(statusCode: StatusCodes.Status200OK)]
        public ActionResult GetUtcTime()
        {
            // Important to keep the following line at the beginning
            var requestReceptionTime = DateTime.UtcNow;
            // Important to keep the following line at the end
            var responseTransmissionTime = DateTime.UtcNow;
            // Implementing NTP on such a high level results in this useless
            // information being sent. On the other hand it enables future additions.
            return new UtcTimeResponse(requestReceptionTime, responseTransmissionTime);
        }
    }
}