// SPDX-License-Identifier: AGPL-3.0-only
// Provenance-includes-location: https://github.com/cortexproject/cortex/blob/master/pkg/ruler/rulespb/rules.proto
// Provenance-includes-license: Apache-2.0
// Provenance-includes-copyright: The Cortex Authors.

syntax = "proto3";

package rules;

option go_package = "rulespb";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/any.proto";
import "github.com/grafana/mimir/pkg/mimirpb/mimir.proto";

option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;

// RuleGroupDesc is a proto representation of a mimir rule group.
message RuleGroupDesc {
  reserved 5, 7, 8;
  string name = 1;
  string namespace = 2;
  google.protobuf.Duration interval = 3
      [(gogoproto.nullable) = false, (gogoproto.stdduration) = true];
  repeated RuleDesc rules = 4;
  string user = 6;
  // The options field can be used to extend Mimir Ruler functionality without
  // having to repeatedly redefine the proto description. It can also be leveraged
  // to create custom `ManagerOpts` based on rule configs which can then be passed
  // to the Prometheus Manager.
  repeated google.protobuf.Any options = 9;
  repeated string sourceTenants = 10;
}

// RuleDesc is a proto representation of a Prometheus Rule
message RuleDesc {
  reserved 7 to 12;
  string expr = 1;
  string record = 2;
  string alert = 3;
  google.protobuf.Duration for = 4 [(gogoproto.nullable) = false,(gogoproto.stdduration) = true];
  repeated cortexpb.LabelPair labels = 5 [
    (gogoproto.nullable) = false,
    (gogoproto.customtype) = "github.com/grafana/mimir/pkg/mimirpb.LabelAdapter"
  ];
  repeated cortexpb.LabelPair annotations = 6 [
    (gogoproto.nullable) = false,
    (gogoproto.customtype) = "github.com/grafana/mimir/pkg/mimirpb.LabelAdapter"
  ];
}
