using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using TakeoutSaaS.Shared.Abstractions.Serialization;

namespace TakeoutSaaS.Application.Dictionary.Contracts;

/// <summary>
/// 创建字典项请求。
/// </summary>
public sealed class CreateDictionaryItemRequest
{
    /// <summary>
    /// 所属分组 ID。
    /// </summary>
    [Required]
    [JsonConverter(typeof(SnowflakeIdJsonConverter))]
    public long GroupId { get; set; }

    /// <summary>
    /// 字典项键。
    /// </summary>
    [Required, MaxLength(64)]
    public string Key { get; set; } = string.Empty;

    /// <summary>
    /// 字典项值。
    /// </summary>
    [Required, MaxLength(256)]
    public string Value { get; set; } = string.Empty;

    /// <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; }
}
