using System.Text.Json; using ComplianceDAL.DTO.GSTReturn; namespace ComplianceSL; // Deserializes the GSTHeader request header into a GSTHeaderDTO — mirrors how BaseEndpoint // deserializes the Login header into a LoginDTO, but kept local to Compliance's Returns endpoints // (a Compliance-specific concept) rather than added to the shared, cross-module BaseEndpoint class. public static class GSTHeaderParser { private static readonly JsonSerializerOptions Options = new() { PropertyNameCaseInsensitive = true }; public static GSTHeaderDTO Parse(string? json) { if (string.IsNullOrWhiteSpace(json)) return new GSTHeaderDTO(); try { return JsonSerializer.Deserialize(json, Options) ?? new GSTHeaderDTO(); } catch { return new GSTHeaderDTO(); } } }