// src/SIGCM.Domain/Interfaces/IListingRepository.cs
using SIGCM.Domain.Models;
using SIGCM.Domain.Entities;
using SIGCM.Application.DTOs;

namespace SIGCM.Domain.Interfaces;

public interface IListingRepository
{
    Task<int> CreateAsync(Listing listing, Dictionary<int, string> attributes, List<Payment>? payments = null);
    Task<Listing?> GetByIdAsync(int id);
    Task<ListingDetail?> GetDetailByIdAsync(int id);
    Task<IEnumerable<Listing>> GetAllAsync();
    Task<IEnumerable<Listing>> GetByUserIdAsync(int userId);
    Task<int> CountByCategoryIdAsync(int categoryId);
    Task MoveListingsAsync(int sourceCategoryId, int targetCategoryId);
    Task IncrementViewCountAsync(int id);
    Task<IEnumerable<dynamic>> GetActiveCashiersAsync();
    Task UpdateOverlayStatusAsync(int id, int userId, string? status);

    // Búsqueda Simple y Facetada
    Task<IEnumerable<Listing>> SearchAsync(string? query, int? categoryId);
    Task<IEnumerable<Listing>> SearchFacetedAsync(
        string? query,
        int? categoryId,
        Dictionary<string, string>? attributes,
        DateTime? from = null,
        DateTime? to = null,
        string? origin = null,
        string? status = null,
        bool onlyActive = false
    );

    // Impresión
    Task<IEnumerable<Listing>> GetListingsForPrintAsync(DateTime date);

    // Moderación
    Task<IEnumerable<Listing>> GetPendingModerationAsync();
    Task UpdateStatusAsync(int id, string status);
    Task<int> GetPendingCountAsync();

    // Estadísticas
    Task<IEnumerable<CategorySalesReportDto>> GetSalesByRootCategoryAsync(DateTime startDate, DateTime endDate);
    Task<DashboardStats> GetDashboardStatsAsync(DateTime startDate, DateTime endDate);
    Task<AdvancedAnalyticsDto> GetAdvancedAnalyticsAsync(DateTime startDate, DateTime endDate);
    Task<CashierDashboardDto?> GetCashierStatsAsync(int userId, DateTime startDate, DateTime endDate);
    Task<GlobalReportDto> GetDetailedReportAsync(DateTime start, DateTime end, int? userId = null);

    // Pagos
    Task AddPaymentAsync(Payment payment);
}