import { ValidationFailure } from "../shared/ValidationFailure" ; export class RuleApplicationOutcome { private failures : ValidationFailure [ ] = [ ] ; constructor ( private validationFailure ? ) { if ( validationFailure ) { this . addValidationFailure ( validationFailure ) ; } } isSuccess ( ) { return this . failures . length === 0 ; } isFailure ( ) { return ! this . isSuccess ( ) ; } addValidationFailure ( failure ) { this . failures . push ( failure ) ; } getValidationFailures ( ) { return this . failures . slice ( 0 ) ; } }