using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;

namespace SessionZeroBackend.Controllers;

[ApiController]
[Route("api/[controller]")]
public class DatabaseController : ControllerBase
{
    private readonly ApplicationDbContext _context;

    public DatabaseController(ApplicationDbContext context)
    {
        _context = context;
    }

    // [HttpGet("verify-users-table")]
    // public async Task<IActionResult> VerifyUsersTable()
    // {
    //     try
    //     {
    //         var tableExists = await _context.Users.AnyAsync();
    //         return Ok(new
    //         {
    //             Message = "Users table exists and can be queried.",
    //             CanQuery = true
    //         });
    //     }
    //     catch (Exception ex)
    //     {
    //         return StatusCode(500, new
    //         {
    //             Message = "Error accessing users table",
    //             Error = ex.Message
    //         });
    //     }
    // }

    [HttpGet("validate-server")]
    public IActionResult ValidateServer()
    {
        return Ok(new
        {
            IsValid = true,
            Message = "SessionZero server is running.",
        });
    }
}