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

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

option go_package            = "github.com/sentinel-official/hub/x/node/types";
option (gogoproto.equal_all) = false;
option (gogoproto.goproto_getters_all) = false;

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

message QueryNodesForPlanRequest {
  uint64 id                                        = 1;
  sentinel.types.v1.Status status                  = 2;
  cosmos.base.query.v1beta1.PageRequest pagination = 3;
}

message QueryNodeRequest { string address = 1; }

message QueryParamsRequest {}

message QueryNodesResponse {
  repeated Node nodes = 1 [ (gogoproto.nullable) = false ];
  cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

message QueryNodesForPlanResponse {
  repeated Node nodes = 1 [ (gogoproto.nullable) = false ];
  cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

message QueryNodeResponse { Node node = 1 [ (gogoproto.nullable) = false ]; }

message QueryParamsResponse {
  Params params = 1 [ (gogoproto.nullable) = false ];
}

service QueryService {
  rpc QueryNodes(QueryNodesRequest) returns (QueryNodesResponse) {
    option (google.api.http).get = "/sentinel/nodes";
  }

  rpc QueryNodesForPlan(QueryNodesForPlanRequest)
      returns (QueryNodesForPlanResponse) {
    option (google.api.http).get = "/sentinel/plans/{id}/nodes";
  }

  rpc QueryNode(QueryNodeRequest) returns (QueryNodeResponse) {
    option (google.api.http).get = "/sentinel/nodes/{address}";
  }

  rpc QueryParams(QueryParamsRequest) returns (QueryParamsResponse) {
    option (google.api.http).get = "/sentinel/modules/node/params";
  }
}
