24 lines
908 B
C#
24 lines
908 B
C#
using System.Net.Http.Json;
|
|
using System.Text.Json;
|
|
|
|
namespace EnvelopeGenerator.Server.Client.Services;
|
|
|
|
/// <summary>
|
|
/// Client-side DTO mirroring CustomImageEntry on the server.
|
|
/// Height is a CSS value string (e.g. "28px") set in appsettings.json.
|
|
/// </summary>
|
|
public sealed record CustomImageDto(string Src, string Height, Dictionary<string, string> Classes)
|
|
{
|
|
public CustomImageDto() : this(string.Empty, "28px", new()) { }
|
|
|
|
/// <summary>Returns the CSS class for the given context key, or empty string if absent.</summary>
|
|
public string GetClass(string key) =>
|
|
Classes.TryGetValue(key, out var cls) && cls is not null ? cls : string.Empty;
|
|
}
|
|
|
|
/// <summary>Client-side DTO for the full CustomImages config (App + Company logos).</summary>
|
|
public sealed record CustomImagesDto(CustomImageDto App, CustomImageDto Company)
|
|
{
|
|
public CustomImagesDto() : this(new(), new()) { }
|
|
}
|