using MediatR;
using System.ComponentModel.DataAnnotations;

namespace TakeoutSaaS.Application.App.Merchants.Commands;

/// <summary>
/// 调整类目排序。
/// </summary>
public sealed record ReorderMerchantCategoriesCommand : IRequest<bool>
{
    /// <summary>
    /// 租户 ID。
    /// </summary>
    [Range(1, long.MaxValue)]
    public long TenantId { get; init; }

    /// <summary>
    /// 排序条目。
    /// </summary>
    [Required, MinLength(1)]
    public IReadOnlyList<MerchantCategoryOrderItem> Items { get; init; } = [];
}

/// <summary>
/// 类目排序条目。
/// </summary>
public sealed record MerchantCategoryOrderItem(
    [property: Required] long CategoryId,
    [property: Range(-1000, 100000)] int DisplayOrder);
