using EnvelopeGenerator.Application.Common.Dto.Messaging;
namespace EnvelopeGenerator.Application.Common.Extensions;
///
/// Provides extension methods for common mapping and conversion operations.
///
public static class MappingExtensions
{
///
/// Determines whether the response indicates a successful "OK" message status.
///
/// The response object to evaluate.
/// if the response contains a "message-status" key with a value of "ok" (case-insensitive);
/// otherwise, .
public static bool Ok(this GtxMessagingResponse gtxMessagingResponse)
=> gtxMessagingResponse.TryGetValue("message-status", out var status)
&& status?.ToString()?.ToLower() == "ok";
///
/// Converts the specified byte array to its equivalent string representation encoded in base-64.
///
/// The byte array to encode.
/// A base-64 encoded string representation of the input byte array.
public static string ToBase64String(this byte[] bytes)
=> Convert.ToBase64String(bytes);
}