using FluentValidation; using Indotalent.Shared.Consts; namespace Indotalent.Features.Organization.Branch.Cqrs; public class UpdateBranchValidator : AbstractValidator { public UpdateBranchValidator() { RuleFor(x => x.Id) .NotEmpty().WithMessage("ID is required for update"); RuleFor(x => x.Code) .NotEmpty().WithMessage("Branch Code is required") .MaximumLength(GlobalConsts.StringLengthShort); RuleFor(x => x.Name) .NotEmpty().WithMessage("Branch Name is required") .MaximumLength(GlobalConsts.StringLengthShort); RuleFor(x => x.City) .NotEmpty().WithMessage("City is required"); RuleFor(x => x.StreetAddress) .NotEmpty().WithMessage("Street Address is required"); RuleFor(x => x.Email) .EmailAddress().When(x => !string.IsNullOrEmpty(x.Email)); } }