// Beacon Chain DNA definitions (filter).
syntax = "proto3";

package beaconchain.v2;

import "v2/common.proto";

message Filter {
  // Include header.
  HeaderFilter header = 1;
  // Filter transactions.
  repeated TransactionFilter transactions = 2;
  // Filter validators.
  repeated ValidatorFilter validators = 3;
  // Filter blobs.
  repeated BlobFilter blobs = 4;
}

enum HeaderFilter {
  HEADER_FILTER_UNSPECIFIED = 0;
  HEADER_FILTER_ALWAYS = 1;
  HEADER_FILTER_ON_DATA = 2;
  HEADER_FILTER_ON_DATA_OR_ON_NEW_BLOCK = 3;
}

message TransactionFilter {
  uint32 id = 1;
  // Filter based on the transaction's sender address.
  Address from = 2;
  // Filter based on the transaction's recipient address.
  Address to = 3;
  // Only return `create` transactions. Defaults to `false`.
  optional bool create = 4;
  // Include the transaction's blob. Defaults to `false`.
  optional bool include_blob = 5;
}

message ValidatorFilter {
  uint32 id = 1;
  // Filter the validator based on its index.
  optional uint32 validator_index = 2;
  // Filter based on the validator's status.
  optional ValidatorStatus status = 3;
}

message BlobFilter {
  uint32 id = 1;
  // Include the transaction that posted the blob.
  optional bool include_transaction = 2;
}
