// Copyright © Selmo Technology GmbH. All Rights Reserved

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SelmoStudio.Hmi.Plugin.Model.RestApi;
using SelmoStudio.Hmi.Server.Db.Authentication;

namespace SelmoStudio.Hmi.Server.Api
{
    /*
     This controller is ONLY for test reasons!!!!!!!!!!

     */

    [Route("api/[controller]")]
    [ApiController]
    public class TestUserManagementController : Controller
    {
        [Authorize(Policy = WellKnownPolicies.ReadHistoryValue)]
        //[Authorize(Policy = WellKnownPolicies.WriteHistoryValue)]
        [HttpPost("testpost1")]
        [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(string))]
        [ProducesResponseType(StatusCodes.Status500InternalServerError)]
        [ProducesResponseType(StatusCodes.Status400BadRequest)]
        public async Task<IActionResult> TestPost1([FromBody] string request)
        {
            var user = this.User;
            var claims = user.Claims;

            var response = $"Received {request}";

            return Ok(response);
        }
    }
}