using Asp.Versioning; using Microsoft.AspNetCore.Mvc; using TarninaHub.Application.Abstractions; using TarninaHub.Application.Dtos; namespace TarninaHub.Controllers; [ApiController] [ApiVersion("1.0")] [Route("api/system")] public class SystemController : ControllerBase { private readonly IStorageService _storageService; public SystemController(IStorageService storageService) { _storageService = storageService; } [HttpGet("storage")] public async Task> GetStorage(CancellationToken cancellationToken) { var info = _storageService.GetInfo(); var probeCount = await _storageService.GetProbeCountAsync(cancellationToken); return Ok(new StorageStatusResponse( info.Engine, info.DataDirectory, info.Namespace, info.Database, probeCount)); } [HttpPost("storage/probes")] public async Task> CreateProbe(CancellationToken cancellationToken) { var probe = await _storageService.AddProbeAsync(cancellationToken); return Ok(new StorageProbeResponse(probe.Label, probe.CreatedAt)); } }