SF-74: Models — CustomImagesOptions (Server, Options Pattern), CustomImagesDto (Client)
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
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()) { }
|
||||
}
|
||||
Reference in New Issue
Block a user