using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using XF.Utility.UnifyResponse;

namespace Identity.Host.Apis
{
    [ApiController]
    [Produces("application/json")]
    [Route("api/v1/[controller]")]

    public class TestController : ControllerBase
    {
        [Authorize]
        [HttpGet("time")]
        public async Task<ApiResponse<string>> Time()
        {
            var data = DateTime.Now.ToString("F");
            return new ApiResponse<string>
            {
                Result = data
            };
        }

        [AllowAnonymous]
        [HttpGet("time1")]
        public async Task<ApiResponse<string>> Time1()
        {
            var data = DateTime.Now.ToString("F");
            return new ApiResponse<string>
            {
                Result = data
            };
        }

        [HttpPost("time")]
        public async Task<ApiResponse<string>> Time(int t)
        {
            var data = DateTime.Now.ToString("F");
            return new ApiResponse<string>
            {
                Result = $"{data} - {t}"
            };
        }
    }
}
