using System.Diagnostics;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using watcher_monitoring.Models;

using watcher_monitoring.Data;
using watcher_monitoring.ViewModels;
using Microsoft.EntityFrameworkCore;

namespace watcher_monitoring.Controllers;

[Authorize]
[Route("[controller]")]
public class MonitoringController : Controller
{
    private readonly WatcherDbContext _context;

    private readonly ILogger<MonitoringController> _logger;

    public MonitoringController(WatcherDbContext context, ILogger<MonitoringController> logger)
    {
        _context = context;
        _logger = logger;
    }

    [HttpGet("container")]
    public async Task<IActionResult> ContainerIndex()
    {
        return View();
    }

    [HttpGet("server")]
    public async Task <IActionResult> ServerIndex()
    {
        var ServerIndexViewModel = new ServerIndexViewModel
        {
            servers = await _context.Servers.ToListAsync()
        };

        return View(ServerIndexViewModel);
    }

}