// Keep in sync with schema at https://slsa.dev/provenance/v0.2
syntax = "proto3";

package in_toto_attestation.predicates.provenance.v02;

import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";

option go_package = "github.com/in-toto/attestation/go/predicates/provenance/v02";
option java_package = "io.github.intoto.attestation.predicates.provenance.v02";

// Proto representation of predicate type https://slsa.dev/provenance/v0.2
// Validation of all fields is left to the users of this proto.
message Provenance {
  Builder builder = 1;
  string build_type = 2;
  Invocation invocation = 3;
  google.protobuf.Struct build_config = 4;
  Metadata metadata = 5;
  repeated Material materials = 6;
}

message Builder {
  string id = 1;
}

message Invocation {
  ConfigSource config_source = 1;
  google.protobuf.Struct parameters = 2;
  google.protobuf.Struct environment = 3;
}

message ConfigSource {
  string uri = 1;
  map<string, string> digest = 2;
  string entry_point = 3;
}

message Metadata {
  string build_invocation_id = 1;
  google.protobuf.Timestamp build_started_on = 2;
  google.protobuf.Timestamp build_finished_on = 3;
  Completeness completeness = 4;
  bool reproducible = 5;
}

message Completeness {
  bool parameters = 1;
  bool environment = 2;
  bool materials = 3;
}

message Material {
  string uri = 1;
  map<string, string> digest = 2;
}
