using FluentValidation;
using IWS5.Core.Models.Request;
using IWS5.DatabaseAccess.Interfaces;

namespace IWS5.Services.Validators
{
    public class SignWorkItemsRequestValidator: AbstractValidator<SignWorkitemListRequest>
    {
        public SignWorkItemsRequestValidator(IDocumentRepository documentRepository)
        {
            RuleFor(x => x.WorkItemIds)
                .NotEmpty().WithMessage("At least one work item ID is required.")
                .Must(ids => ids.All(id => id > 0)).WithMessage("All work item IDs must be greater than 0.");
            
            RuleFor(x => x.FileBytes)
            .NotNull().NotEmpty().WithMessage("Signature file is required.");

            RuleFor(x => x.Password)
                .NotEmpty().WithMessage("Password is required.");

            RuleFor(x => x.issuer)
                .NotEmpty().WithMessage("Issuer is required.");
        }
    }
}
