LabelTemplateCreateInputVo.cs 3.69 KB
using System.Text.Json.Serialization;

namespace FoodLabeling.Application.Contracts.Dtos.LabelTemplate;

public class LabelTemplateCreateInputVo
{
    /// <summary>
    /// editor JSON 里的 id,对应数据库 fl_label_template.TemplateCode
    /// </summary>
    [JsonPropertyName("id")]
    public string TemplateCode { get; set; } = string.Empty;

    /// <summary>
    /// editor JSON 里的 name,对应数据库 fl_label_template.TemplateName
    /// </summary>
    [JsonPropertyName("name")]
    public string TemplateName { get; set; } = string.Empty;

    [JsonPropertyName("labelType")]
    public string? LabelType { get; set; }

    [JsonPropertyName("unit")]
    public string Unit { get; set; } = "inch";

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

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

    /// <summary>
    /// editor JSON 里的 appliedLocation(ALL / SPECIFIED,Location 维度)
    /// </summary>
    [JsonPropertyName("appliedLocation")]
    public string AppliedLocationType { get; set; } = "ALL";

    /// <summary>适用 Company:ALL / SPECIFIED</summary>
    [JsonPropertyName("appliedPartnerType")]
    public string? AppliedPartnerType { get; set; }

    /// <summary>适用 Company(与 <see cref="CompanyIds"/> 合并)</summary>
    [JsonPropertyName("partnerIds")]
    public List<string>? PartnerIds { get; set; }

    /// <summary>适用 Company(<c>fl_partner.Id</c>,与 <see cref="PartnerIds"/> 相同)</summary>
    [JsonPropertyName("companyIds")]
    public List<string>? CompanyIds { get; set; }

    /// <summary>适用 Region:ALL / SPECIFIED</summary>
    [JsonPropertyName("appliedRegionType")]
    public string? AppliedRegionType { get; set; }

    [JsonPropertyName("showRuler")]
    public bool ShowRuler { get; set; } = true;

    [JsonPropertyName("showGrid")]
    public bool ShowGrid { get; set; } = true;

    /// <summary>整标签外框:none / line / dotted</summary>
    [JsonPropertyName("border")]
    public string BorderType { get; set; } = "none";

    /// <summary>打印方向:vertical / horizontal</summary>
    [JsonPropertyName("printOrientation")]
    public string PrintOrientationType { get; set; } = "vertical";

    /// <summary>
    /// 预留:前端可能不传;如果不传则默认 true
    /// </summary>
    [JsonPropertyName("state")]
    public bool State { get; set; } = true;

    /// <summary>
    /// elements(前端 editor 的 elements[],会全量重建)
    /// </summary>
    [JsonPropertyName("elements")]
    public List<LabelTemplateElementDto> Elements { get; set; } = new();

    /// <summary>
    /// 当 AppliedLocationType=SPECIFIED 时生效(与 <see cref="LocationIds"/> 合并去重)
    /// </summary>
    [JsonPropertyName("appliedLocationIds")]
    public List<string>? AppliedLocationIds { get; set; }

    /// <summary>
    /// 适用 Region 多选(<c>fl_group.Id</c>);与 <see cref="GroupIds"/> 合并去重
    /// </summary>
    [JsonPropertyName("regionIds")]
    public List<string>? RegionIds { get; set; }

    /// <summary>
    /// 适用 Region 多选,与 <see cref="RegionIds"/> 相同
    /// </summary>
    [JsonPropertyName("groupIds")]
    public List<string>? GroupIds { get; set; }

    /// <summary>
    /// 适用门店多选(<c>location.Id</c>);与 Region 合并后写入 <c>fl_label_template_location</c>
    /// </summary>
    [JsonPropertyName("locationIds")]
    public List<string>? LocationIds { get; set; }

    /// <summary>
    /// 模板与产品/标签类型绑定默认值
    /// </summary>
    [JsonPropertyName("templateProductDefaults")]
    public List<LabelTemplateProductDefaultDto>? TemplateProductDefaults { get; set; }
}