41 lines
1.9 KiB
C#
41 lines
1.9 KiB
C#
using Extrudex.Domain.Enums;
|
|
|
|
namespace Extrudex.Domain.Interfaces;
|
|
|
|
/// <summary>
|
|
/// Service interface for generating QR codes that encode deep links to
|
|
/// Extrudex resources (spools, printers, locations). QR codes are
|
|
/// high-contrast and optimized for small label printing.
|
|
/// </summary>
|
|
public interface IQrCodeService
|
|
{
|
|
/// <summary>
|
|
/// Generates a PNG QR code image for the specified resource type and ID.
|
|
/// The encoded URL points to the resource's detail page in the Extrudex frontend.
|
|
/// </summary>
|
|
/// <param name="resourceType">The type of resource (Spool, Printer, Location).</param>
|
|
/// <param name="id">The unique identifier of the resource.</param>
|
|
/// <param name="pixelsPerModule">
|
|
/// Pixel density per QR module. Higher values produce larger images.
|
|
/// Default (20) balances readability and label size.
|
|
/// </param>
|
|
/// <returns>A byte array containing the PNG image data.</returns>
|
|
byte[] GeneratePng(QrResourceType resourceType, Guid id, int pixelsPerModule = 20);
|
|
|
|
/// <summary>
|
|
/// Generates an SVG QR code image for the specified resource type and ID.
|
|
/// SVG is resolution-independent and ideal for printing at any scale.
|
|
/// </summary>
|
|
/// <param name="resourceType">The type of resource (Spool, Printer, Location).</param>
|
|
/// <param name="id">The unique identifier of the resource.</param>
|
|
/// <returns>A string containing the SVG markup.</returns>
|
|
string GenerateSvg(QrResourceType resourceType, Guid id);
|
|
|
|
/// <summary>
|
|
/// Constructs the URL that will be encoded into the QR code for the given resource.
|
|
/// </summary>
|
|
/// <param name="resourceType">The type of resource.</param>
|
|
/// <param name="id">The unique identifier of the resource.</param>
|
|
/// <returns>The absolute URL to be encoded in the QR code.</returns>
|
|
string GetResourceUrl(QrResourceType resourceType, Guid id);
|
|
} |