Files
I150/srcs/RobotNet10/RobotApp/RobotNet10.RobotApp.Client/Shared/Devices/PropertyDescription.cs
2026-07-03 16:37:12 +07:00

70 lines
2.1 KiB
C#

namespace RobotNet10.RobotApp.Client.Shared.Devices;
/// <summary>
/// Mô tả một property của thiết bị (dùng để hiển thị trên web UI)
/// </summary>
public class PropertyDescription
{
/// <summary>
/// Tên key của property (phải khớp với key trong Properties dictionary)
/// </summary>
public string Key { get; set; } = string.Empty;
/// <summary>
/// Tên hiển thị trên UI
/// </summary>
public string DisplayName { get; set; } = string.Empty;
/// <summary>
/// Mô tả chi tiết về property
/// </summary>
public string? Description { get; set; }
/// <summary>
/// Loại dữ liệu (ví dụ: "string", "number", "boolean", "date", "url", etc.)
/// </summary>
public string DataType { get; set; } = "string";
/// <summary>
/// Đơn vị đo (ví dụ: "V", "A", "Hz", "°C", "m/s", etc.) - null nếu không có
/// </summary>
public string? Unit { get; set; }
/// <summary>
/// Giá trị mặc định
/// </summary>
public string? DefaultValue { get; set; }
/// <summary>
/// Có thể chỉnh sửa trên UI hay không
/// </summary>
public bool IsReadOnly { get; set; } = false;
/// <summary>
/// Thứ tự hiển thị trên UI (số nhỏ hơn hiển thị trước)
/// </summary>
public int DisplayOrder { get; set; } = 0;
/// <summary>
/// Nhóm/category của property (để nhóm các properties lại với nhau trên UI)
/// </summary>
public string? Category { get; set; }
/// <summary>
/// Format string để hiển thị giá trị (ví dụ: "{0:F2}", "{0:yyyy-MM-dd}", etc.)
/// </summary>
public string? Format { get; set; }
public PropertyDescription()
{
}
public PropertyDescription(string key, string displayName, string? description = null)
{
Key = key ?? throw new ArgumentNullException(nameof(key));
DisplayName = displayName ?? throw new ArgumentNullException(nameof(displayName));
Description = description;
}
}