using FluentValidation;
using TakeoutSaaS.Application.App.Stores.Commands;

namespace TakeoutSaaS.Application.App.Stores.Validators;

/// <summary>
/// 更新门店命令验证器。
/// </summary>
public sealed class UpdateStoreCommandValidator : AbstractValidator<UpdateStoreCommand>
{
    /// <summary>
    /// 初始化验证规则。
    /// </summary>
    public UpdateStoreCommandValidator()
    {
        RuleFor(x => x.StoreId).GreaterThan(0);
        RuleFor(x => x.MerchantId).GreaterThan(0);
        RuleFor(x => x.Code).NotEmpty().MaximumLength(32);
        RuleFor(x => x.Name).NotEmpty().MaximumLength(128);
        RuleFor(x => x.Phone).MaximumLength(32);
        RuleFor(x => x.ManagerName).MaximumLength(64);
        RuleFor(x => x.Province).MaximumLength(64);
        RuleFor(x => x.City).MaximumLength(64);
        RuleFor(x => x.District).MaximumLength(64);
        RuleFor(x => x.Address).MaximumLength(256);
        RuleFor(x => x.Announcement).MaximumLength(512);
        RuleFor(x => x.Tags).MaximumLength(256);
        RuleFor(x => x.DeliveryRadiusKm).GreaterThanOrEqualTo(0);
    }
}
