using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentValidation;
using Hotline.BatchTask;
using Hotline.Share.Dtos.BatchTask;

namespace Hotline.Validators.BatchTask;

public class ApptaskValidator : AbstractValidator<AddApptaskRequest>
{
    public ApptaskValidator()
    {
        RuleFor(d => d.TaskType)
            .Cascade(CascadeMode.Stop)
            .NotEmpty()
            .IsInEnum()
            .WithMessage("任务类型不能为空");

        RuleFor(d => d.ApptaskItems)
            .NotEmpty()
            .WithMessage("任务明细不能为空");

        RuleForEach(d => d.ApptaskItems)
            .SetValidator(new ApptaskItemValidator());
    }
}

public class ApptaskItemValidator : AbstractValidator<AddApptaskItemRequest>
{
    public ApptaskItemValidator()
    {
        RuleFor(d => d.BusinessId)
            .NotEmpty()
            .WithMessage("业务id不能为空");
    }
}