LabelTemplateElementDto.cs 1.97 KB
using System.Text.Json.Serialization;

namespace FoodLabeling.Application.Contracts.Dtos.LabelTemplate;

/// <summary>
/// 模板元素(对齐 editor JSON:id/type/typeAdd/elementName/x/y/width/height/rotation/border/config 等)
/// </summary>
public class LabelTemplateElementDto
{
    [JsonPropertyName("id")]
    public string Id { get; set; } = string.Empty;

    [JsonPropertyName("type")]
    public string ElementType { get; set; } = string.Empty;

    /// <summary>
    /// 元素附加类型(分组前缀 + 控件名),如 label_Duration
    /// </summary>
    [JsonPropertyName("typeAdd")]
    public string? TypeAdd { get; set; }

    [JsonPropertyName("elementName")]
    public string ElementName { get; set; } = string.Empty;

    [JsonPropertyName("x")]
    public decimal PosX { get; set; }

    [JsonPropertyName("y")]
    public decimal PosY { get; set; }

    [JsonPropertyName("width")]
    public decimal Width { get; set; }

    [JsonPropertyName("height")]
    public decimal Height { get; set; }

    [JsonPropertyName("rotation")]
    public string Rotation { get; set; } = "horizontal";

    [JsonPropertyName("border")]
    public string BorderType { get; set; } = "none";

    [JsonPropertyName("zIndex")]
    public int ZIndex { get; set; }

    [JsonPropertyName("orderNum")]
    public int OrderNum { get; set; }

    /// <summary>
    /// 值来源:FIXED / AUTO_DB / PRINT_INPUT
    /// </summary>
    [JsonPropertyName("valueSourceType")]
    public string ValueSourceType { get; set; } = "FIXED";

    [JsonPropertyName("bindingExpr")]
    public string? BindingExpr { get; set; }

    [JsonPropertyName("autoQueryKey")]
    public string? AutoQueryKey { get; set; }

    [JsonPropertyName("inputKey")]
    public string? InputKey { get; set; }

    [JsonPropertyName("isRequiredInput")]
    public bool IsRequiredInput { get; set; }

    /// <summary>
    /// 元素配置
    /// </summary>
    [JsonPropertyName("config")]
    public object? ConfigJson { get; set; }
}