blob: c8172c8cb39587ee843ca77d1f017d6d74226c5a [file] [edit]
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef THIRD_PARTY_CREDENTIO_VALIDATOR_MANIFEST_CONSUMER_H_
#define THIRD_PARTY_CREDENTIO_VALIDATOR_MANIFEST_CONSUMER_H_
#include "absl/status/status.h"
#include "proto/ingredient_validation_result.pb.h"
#include "proto/manifest.pb.h"
namespace credentio {
// Interface for consumers that observe manifest validation events during
// manifest graph traversal.
//
// Consumers are the extension point for enrichment that the validator itself
// does not implement, e.g. deriving a digital source type from the actions
// recorded in the manifests. Validation results are identical with and without
// consumers; only the enriched fields differ.
class ManifestConsumer {
public:
virtual ~ManifestConsumer() = default;
// Called when a manifest node has been successfully validated.
// `is_active_manifest` indicates if this is the root active manifest.
virtual absl::Status OnManifestValidated(const Manifest& manifest,
bool is_active_manifest) = 0;
// Called after a complete ingredient validation result has been converted
// from a validation result.
virtual absl::Status OnIngredientValidationResultComplete(
IngredientValidationResultProto* ingredient_result) {
return absl::OkStatus();
}
};
} // namespace credentio
#endif // THIRD_PARTY_CREDENTIO_VALIDATOR_MANIFEST_CONSUMER_H_