using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using DomainResults.Mvc;
using WeatherForecast.Services;
namespace WeatherForecast.Controllers;
/// 
/// 
/// 
[ApiController]
[Route("api/[controller]")]
public class CategoryItemsController : ControllerBase {
  private readonly IAuthorizationService _authorizationService;
  private readonly ICategoryItemsService _categoryItemsService;
  /// 
  /// 
  /// 
  /// 
  /// 
  public CategoryItemsController(
    IAuthorizationService authorizationService,
    ICategoryItemsService categoryItemsService
  ) {
    _authorizationService = authorizationService;
    _categoryItemsService = categoryItemsService;
  }
  #region Authless methods
  /// 
  /// 
  /// 
  /// 
  /// 
  /// 
  [HttpGet("{siteId}")]
  public IActionResult Get([FromRoute] Guid siteId, [FromQuery] string? locale) {
    var result = _categoryItemsService.Get(siteId, locale);
    return result.ToActionResult();
  }
  #endregion
  //[HttpDelete("{siteId}")]
  //public async Task Delete([FromRoute] Guid siteId) {
  //  if ((await _authorizationService.AuthorizeAsync(User, null, new CategoryAuthorizationRequirement(true, CrudActions.Delete))).Succeeded) {
  //    var result = _categoryItemsService.Delete(siteId);
  //    return result.ToActionResult();
  //  }
  //  else {
  //    return Unauthorized();
  //  }
  //}
}