using Microsoft.AspNetCore.Authorization;
using OpenWarehouse.auth.lib.Model.Service;

namespace OpenWarehouse.auth.api.Controller;

[ApiController]
[Route("[action]")]
public class Tools(
    ILogger<Tools> logger) : ControllerBase
{
    [HttpGet]
    public Task<ActionResult<PingModel>> Ping()
    {
        logger.LogInformation("Ping request received.");
        return Task.FromResult<ActionResult<PingModel>>(Ok(new PingModel()));
    }


    [HttpGet]
    public Task<ActionResult<bool>> TestAuthStatus()
    {
        logger.LogInformation($"Test auth status request received for user: {User.Identity?.Name ?? "Unknown"}.");
        return Task.FromResult<ActionResult<bool>>(User.Identity?.IsAuthenticated);
    }
}