using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using DomainResults.Mvc;
using WeatherForecast.Services;
namespace WeatherForecast.Controllers;
/// 
/// 
/// 
[AllowAnonymous]
[ApiController]
[Route("api/[controller]")]
public class ShopItemsController : ControllerBase {
  private readonly ILogger _logger;
  private readonly IShopItemsService _shopItemsService;
  /// 
  /// 
  /// 
  /// 
  /// 
  public ShopItemsController(
    ILogger logger,
    IShopItemsService shopCatalogService
  ) {
    _logger = logger;
    _shopItemsService = shopCatalogService;
  }
  /// 
  /// 
  /// 
  /// 
  /// 
  /// 
  /// 
  /// 
  /// 
  /// 
  [HttpGet("{siteId}")]
  public IActionResult Get([FromRoute] Guid siteId,  [FromQuery] Guid? category, [FromQuery] int? currentPage, [FromQuery] int? itemsPerPage, [FromQuery] string? locale, [FromQuery] string? searchText) {
    var result = _shopItemsService.Get(siteId, category, currentPage ?? 1, itemsPerPage ?? 8, locale, searchText);
    return result.ToActionResult();
  }
  /// 
  /// 
  /// 
  /// 
  /// 
  [HttpDelete("{siteId}")]
  public IActionResult Delete([FromRoute] Guid siteId) {
    var result = _shopItemsService.Delete(siteId);
    return result.ToActionResult();
  }
}