using ERPCore.Dtos.Common;
using ERPCore.Dtos.Hrm;
using ERPCore.Domain.Enums;

namespace ERPCore.Services.Interfaces;

/// <summary>Leave request business logic (FR-HR-LV-02, docs/13-BACKEND-HRM-API.md §5).</summary>
public interface ILeaveRequestService
{
    Task<PagedResponse<LeaveRequestDto>> ListAsync(PageQuery query, int? employeeId, LeaveRequestStatus? status, CancellationToken ct = default);
    Task<LeaveRequestDto?> GetAsync(int leaveRequestId, CancellationToken ct = default);
    Task<LeaveRequestDto> CreateAsync(CreateLeaveRequestRequest request, int actorUserId, CancellationToken ct = default);
    Task<LeaveRequestDto> SubmitAsync(int leaveRequestId, CancellationToken ct = default);
    Task<LeaveRequestDto> ApproveAsync(int leaveRequestId, int actorUserId, CancellationToken ct = default);
    Task<LeaveRequestDto> RejectAsync(int leaveRequestId, string reason, int actorUserId, CancellationToken ct = default);
    Task<LeaveRequestDto> CancelAsync(int leaveRequestId, CancellationToken ct = default);

    /// <summary>True if the employee has an Approved leave request covering the given date (used by Attendance's OnLeave classification).</summary>
    Task<Domain.Entities.LeaveRequest?> FindApprovedLeaveCoveringAsync(int employeeId, DateTime date, CancellationToken ct = default);
}
