using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace PayRollBLL.SAPPaySlip.Client
{
///
/// Deserialisation target for the SAP OData v2 JSON error envelope.
///
/// SAP returns this structure for any non-2xx response from ZPY_PAYSLIP_SRV:
/// {
/// "error": {
/// "code": "HTTP/400",
/// "message": { "lang": "EN", "value": "Employee not found." },
/// "innererror": {
/// "transactionid": "ABCD1234",
/// "errordetails": [
/// { "code": "/ZPY/PAYSLIP/001", "message": "...", "severity": "error" }
/// ]
/// }
/// }
/// }
///
internal sealed class SapODataErrorResponse
{
[JsonPropertyName("error")]
public SapODataError? Error { get; set; }
}
internal sealed class SapODataError
{
[JsonPropertyName("code")]
public string? Code { get; set; }
[JsonPropertyName("message")]
public SapODataErrorMessage? Message { get; set; }
[JsonPropertyName("innererror")]
public SapODataInnerError? InnerError { get; set; }
}
internal sealed class SapODataErrorMessage
{
[JsonPropertyName("lang")]
public string? Lang { get; set; }
[JsonPropertyName("value")]
public string? Value { get; set; }
}
internal sealed class SapODataInnerError
{
[JsonPropertyName("transactionid")]
public string? TransactionId { get; set; }
[JsonPropertyName("errordetails")]
public List? ErrorDetails { get; set; }
}
internal sealed class SapODataErrorDetail
{
[JsonPropertyName("code")]
public string? Code { get; set; }
[JsonPropertyName("message")]
public string? Message { get; set; }
[JsonPropertyName("severity")]
public string? Severity { get; set; }
}
}