using Domain.Dtos.Sales;
using Domain.Entities;
using Domain.Generics;

namespace Models.Interfaces
{
    public interface IPhSSalesDocumentRepository
    {
        Task<PagedResult<SalesDocumentSummaryDto>> SearchAsync(
            int? customerId,
            string? customerText,
            int? quoteId,
            int? documentType,
            int? status,
            DateTime? issueDateFrom,
            DateTime? issueDateTo,
            int page = 1,
            int pageSize = 50);

        Task<ESalesDocument> CreateAsync(ESalesDocument entity);
        Task<ESalesDocument> CreateFromDeliveryNotesAsync(ESalesDocument entity, IReadOnlyCollection<int> deliveryNoteIds);
        Task<ESalesDocument> CreateFromDeliveryNoteItemsAsync(ESalesDocument entity);
        Task<List<DeliveryNoteDto>> GetDeliveryNotesForSalesDocumentAsync(IReadOnlyCollection<int> deliveryNoteIds);
        Task<List<SalesDocumentDeliveryNoteItemCandidateDto>> GetDeliveryNoteItemCandidatesForSalesDocumentAsync(IReadOnlyCollection<int> deliveryNoteIds);
        Task<List<SalesDocumentDeliveryNoteItemCandidateDto>> GetDeliveryNoteItemCandidatesByDetailIdsForSalesDocumentAsync(IReadOnlyCollection<int> deliveryNoteDetailIds);
        Task<PagedResult<SalesDocumentDeliveryNoteCandidateDto>> SearchDeliveryNoteCandidatesAsync(
            int? customerId,
            string? customerText,
            string? deliveryNoteNumber,
            int? quoteId,
            DateTime? issueDateFrom,
            DateTime? issueDateTo,
            int page = 1,
            int pageSize = 50);
        Task<SalesDocumentDto?> GetDtoByIdAsync(int id);
        Task<SalesDocumentDto?> UpdateDraftReviewAsync(int id, SalesDocumentDraftReviewDto review);
        Task<SalesDocumentDto?> ValidateDraftAsync(int id);
    }
}
