using GB5Shared.DTO.Framework.Login;
using PayRollBLL.SAP.Client;
using System.Collections.Generic;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
namespace PayRollBLL.SAP
{
public interface IITDeclarationSapBLL
{
///
/// Generates SAP-compatible JSON payloads for the requested infotypes.
/// Returns a dictionary keyed by infotype number (e.g. 580, 581…).
/// Infotypes with no matching declaration data are omitted from the result.
///
/// 0 = all matching other filters.
/// 0 = all.
/// 0 = all.
/// 0 = all 580–586; otherwise a single infotype.
/// SAP header date in dd.MM.yyyy format.
/// SAP payload remarks.
Task> GenerateSapPayloadsAsync(
int declarationId,
int employeeId,
int periodId,
int infotype,
string date,
string remarks,
LoginDTO login,
CancellationToken ct);
///
/// Pushes the generated payloads to SAP HTTP endpoints.
/// Returns one result per infotype attempted.
///
Task> PushToSapAsync(
int declarationId,
int employeeId,
int periodId,
int infotype,
string date,
string remarks,
LoginDTO login,
CancellationToken ct);
}
/// SAP infotype number, e.g. 580.
///
/// Sub-type label within an infotype, e.g. "Housing Loan" or "Other Income Sources".
/// Empty string for infotypes with a single sub-type.
///
/// OData entity-set path that was POSTed to.
/// True when SAP confirmed the post without business errors.
/// HTTP status code from SAP (0 = network failure).
/// Raw SAP response body (for diagnostics / audit).
///
/// User-facing result message.
/// Success → "IT Declaration data posted to SAP successfully."
/// SAP error → SAP's exact error text (e.g. "A record already exists …").
/// Network / config error → descriptive reason.
///
/// The JSON payload that was sent to SAP (for diagnostics / audit).
public record SapPushResultDTO(
int Infotype,
string Description,
string EndpointPath,
bool IsSuccess,
int HttpStatus,
string ResponseBody,
string Message,
JsonElement? Payload);
}