using System.Threading;
using System.Threading.Tasks;
namespace PayRollBLL.SAP.Client
{
public interface ISapApiClient
{
///
/// Fetches a fresh SAP CSRF token, then POSTs
/// to .
///
/// Before the HTTP call, the host reachability is verified (TCP connection test).
/// The SAP response is parsed for business-level messages; only SAP's own message
/// text is surfaced — this method never invents its own business error text.
///
/// Never throws on HTTP/network failures — all outcomes are captured in the returned DTO.
///
///
/// OData entity-set path, e.g.
/// "/sap/opu/odata/sap/ZPY_ITDEC_PREVIOUS_SRV/ITDecPreviousHeaderSet".
///
///
/// Navigation property name that carries SAP messages in the response body,
/// e.g. "NAV2ITDECPREVMSG". Pass empty string if unknown (skips message parsing).
///
/// Serialized SAP payload to POST.
Task PostAsync(
string endpointPath,
string msgNavProperty,
string jsonPayload,
CancellationToken ct);
}
/// True when SAP confirmed the data was posted without business errors.
/// HTTP status code returned by SAP (0 = network failure before HTTP).
/// Raw response body from SAP, empty on network failure.
///
/// User-facing message.
/// On success: "IT Declaration data posted to SAP successfully."
/// On SAP business error: SAP's exact error text.
/// On network/config error: descriptive reason (DNS, port, TLS, timeout).
///
public record SapApiResultDTO(
bool IsSuccess,
int StatusCode,
string ResponseBody,
string Message);
}