import { FieldValidation } from '@/validation/protocols' ; import { InvalidFieldError } from '@/validation/errors' ; export class MinLengthValidation implements FieldValidation { constructor ( readonly field , private readonly minLength ) { } validate ( input ) { return input [ this . field ] ?. length < this . minLength ? new InvalidFieldError ( ) : null ; } }