validateComment method

CheckpointValidationError? validateComment(
  1. Checkpoint checkpoint
)

Implementation

CheckpointValidationError? validateComment(Checkpoint checkpoint) {
  return switch (checkpoint.isOk) {
    CheckpointStatus.ok
        when checkpoint.commentReqOk &&
            checkpoint.commentString.isNullOrEmpty =>
      CheckpointValidationError.commentEmpty,

    CheckpointStatus.notOk
        when checkpoint.commentReqNotOk &&
            checkpoint.commentString.isNullOrEmpty =>
      CheckpointValidationError.commentEmpty,

    CheckpointStatus.na
        when checkpoint.commentReqNa &&
            checkpoint.commentString.isNullOrEmpty =>
      CheckpointValidationError.commentEmpty,

    != null || null => null,
    _ => throw KnownException(
      message:
          BasfLogicLocalizationUtils.localizations.checkpointStatusIsMissing,
    ),
  };
}