using System.Linq.Expressions; using SPMS.Domain.Entities; namespace SPMS.Domain.Interfaces; public interface IMessageRepository : IRepository { Task GetByMessageCodeAsync(string messageCode); Task GetByMessageCodeAndServiceAsync(string messageCode, long serviceId); Task GetTodaySequenceAsync(long serviceId); Task<(IReadOnlyList Items, int TotalCount)> GetPagedByServiceAsync( long serviceId, int page, int size, Expression>? predicate = null); Task<(IReadOnlyList Items, int TotalCount)> GetPagedForListAsync( long? serviceId, int page, int size, string? keyword = null, bool? isActive = null, string? sendStatus = null); Task GetByMessageCodeWithDetailsAsync(string messageCode, long serviceId); Task<(int TotalSendCount, int SuccessCount)> GetSendStatsAsync(long messageId); Task> GetTopBySendCountAsync(long? serviceId, int count); } public class MessageListProjection { public string MessageCode { get; set; } = string.Empty; public string Title { get; set; } = string.Empty; public bool IsActive { get; set; } public DateTime CreatedAt { get; set; } public string ServiceName { get; set; } = string.Empty; public string ServiceCode { get; set; } = string.Empty; public int TotalSendCount { get; set; } public int SuccessCount { get; set; } }