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

namespace ERPCore.Services.Interfaces;

/// <summary>Payroll run approval workflow (FR-HR-PAY-05/06, docs/13-BACKEND-HRM-API.md §6).</summary>
public interface IPayrollRunService
{
    Task<PagedResponse<PayrollRunDto>> ListAsync(PageQuery query, int? periodYear, int? periodMonth, PayrollRunStatus? status, CancellationToken ct = default);
    Task<PayrollRunDto?> GetAsync(int payrollRunId, CancellationToken ct = default);
    Task<List<PayrollLineDto>> ListLinesAsync(int payrollRunId, CancellationToken ct = default);
    Task<PayrollLineDetailDto?> GetLineAsync(int payrollRunId, int lineId, CancellationToken ct = default);

    Task<PayrollRunDto> GenerateAsync(GeneratePayrollRunRequest request, int actorUserId, CancellationToken ct = default);
    Task<PayrollRunDto> ApproveAsync(int payrollRunId, int actorUserId, CancellationToken ct = default);
    Task<PayrollRunDto> LockAsync(int payrollRunId, int actorUserId, CancellationToken ct = default);
    Task<PayrollRunDto> UnlockAsync(int payrollRunId, string reason, int actorUserId, CancellationToken ct = default);
    Task<List<PayslipDto>> GeneratePayslipsAsync(int payrollRunId, CancellationToken ct = default);
}
