using FluentValidation;
using Hotline.Share.Dtos.FlowEngine.Workflow;

namespace Hotline.Validators.FlowEngine;

public class StartWorkflowDtoValidator : AbstractValidator<StartWorkflowDto>
{
    public StartWorkflowDtoValidator()
    {
        //RuleFor(d => d.DefinitionCode)
        //    .NotEmpty().When(d => string.IsNullOrEmpty(d.DefinitionModuleCode));
        //RuleFor(d => d.DefinitionModuleCode)
        //    .NotEmpty().When(d => string.IsNullOrEmpty(d.DefinitionCode));

        //RuleFor(d => d.DefinitionModuleCode).NotEmpty();
        //RuleFor(d => d.Title).NotEmpty();
        Include(new BasicWorkflowDtoValidator());
        RuleFor(d => d.NextStepCode).NotEmpty();
        RuleFor(d => d.IsSms).NotNull();
        RuleFor(d => d.IsStartCountersign).NotNull();
        RuleFor(d => d.NextHandlers.Count).LessThanOrEqualTo(1)
            .Unless(d => d.IsStartCountersign);
    }
}