syntax = "proto3";
package sentinel.plan.v2;

option go_package = "github.com/sentinel-official/hub/x/plan/types";

import "cosmos/base/query/v1beta1/pagination.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "sentinel/types/v1/status.proto";
import "sentinel/plan/v2/plan.proto";

option (gogoproto.equal_all)           = false;
option (gogoproto.goproto_getters_all) = false;

message QueryPlansRequest {
  sentinel.types.v1.Status status                  = 1;
  cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

message QueryPlansForProviderRequest {
  string address                                   = 1;
  sentinel.types.v1.Status status                  = 2;
  cosmos.base.query.v1beta1.PageRequest pagination = 3;
}

message QueryPlanRequest { uint64 id = 1; }

message QueryPlansResponse {
  repeated Plan plans = 1 [ (gogoproto.nullable) = false ];
  cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

message QueryPlansForProviderResponse {
  repeated Plan plans = 1 [ (gogoproto.nullable) = false ];
  cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

message QueryPlanResponse { Plan plan = 1 [ (gogoproto.nullable) = false ]; }

service QueryService {
  rpc QueryPlans(QueryPlansRequest) returns (QueryPlansResponse) {
    option (google.api.http).get = "/sentinel/plans";
  }

  rpc QueryPlansForProvider(QueryPlansForProviderRequest)
      returns (QueryPlansForProviderResponse) {
    option (google.api.http).get = "/sentinel/providers/{address}/plans";
  }

  rpc QueryPlan(QueryPlanRequest) returns (QueryPlanResponse) {
    option (google.api.http).get = "/sentinel/plans/{id}";
  }
}
