using System.ComponentModel.DataAnnotations;

namespace TakeoutSaaS.Application.Dictionary.Contracts;

/// <summary>
/// 更新字典项请求。
/// </summary>
public sealed class UpdateDictionaryItemRequest
{
    /// <summary>
    /// 字典项键。
    /// </summary>
    [Required, MaxLength(128)]
    public string Key { get; set; } = string.Empty;

    /// <summary>
    /// 字典项值。
    /// </summary>
    [Required]
    public Dictionary<string, string> Value { get; set; } = new(StringComparer.OrdinalIgnoreCase);

    /// <summary>
    /// 是否默认项。
    /// </summary>
    public bool IsDefault { get; set; }

    /// <summary>
    /// 是否启用。
    /// </summary>
    public bool IsEnabled { get; set; } = true;

    /// <summary>
    /// 排序值。
    /// </summary>
    public int SortOrder { get; set; } = 100;

    /// <summary>
    /// 描述信息。
    /// </summary>
    [MaxLength(512)]
    public string? Description { get; set; }

    /// <summary>
    /// 行版本，用于并发控制。
    /// </summary>
    public uint RowVersion { get; set; }
}
