Files
EnvelopeGenerator/EnvelopeGenerator.Server/EnvelopeGenerator.Server/Models/CustomImages.cs

37 lines
1.3 KiB
C#

namespace EnvelopeGenerator.Server.Models;
/// <summary>
/// A single image asset entry — source path and optional per-context CSS classes.
/// Height controls the rendered size in CSS units (e.g. "28px", "2rem").
/// Change Src and Height in appsettings.json per deployment; no code change required.
/// </summary>
public sealed class CustomImageEntry
{
public string Src { get; set; } = string.Empty;
/// <summary>
/// CSS height value, e.g. "28px" or "2rem".
/// Allows different-sized logos across deployments without CSS changes.
/// </summary>
public string Height { get; set; } = "28px";
public Dictionary<string, string> Classes { get; set; } = 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>
/// Bound from appsettings.json "CustomImages" section via Options Pattern.
/// App = signFLOW application logo.
/// Company = customer/company logo (Digital Data GmbH by default).
/// </summary>
public sealed class CustomImagesOptions
{
public const string SectionName = "CustomImages";
public CustomImageEntry App { get; set; } = new();
public CustomImageEntry Company { get; set; } = new();
}