#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.Models.FileManagement;
using Microsoft.AspNetCore.Mvc;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Controllers.FileManagement;
///
/// Controller for managing file systems.
///
[Route("/file-system")]
public class FileSystemController : Controller
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly IApiHttpClient _apiHttpClient;
#endregion
#region ====================================================================== CTOR =====================================================================================
///
/// Initializes a new instance of the class.
///
/// Injected service for interactions with the API.
public FileSystemController(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
///
/// Gets the type of the file system.
///
/// Cancellation token that can be used to stop the execution.
[HttpGet("get-type")]
public async Task GetType(CancellationToken cancellationToken)
{
FileSystemTypeModel response = await _apiHttpClient.GetAsync($"file-system/get-type", cancellationToken: cancellationToken);
return Json(new { success = true, data = new { platformType = response.PlatformType.ToString() } });
}
#endregion
}