syntax = "proto3";
package akash.deployment.v1beta3;

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "akash/deployment/v1beta3/deployment.proto";
import "akash/deployment/v1beta3/group.proto";
import "akash/deployment/v1beta3/groupid.proto";
import "akash/escrow/v1beta3/types.proto";

option go_package = "github.com/akash-network/akash-api/go/node/deployment/v1beta3";

// Query defines the gRPC querier service
service Query {
  // Deployments queries deployments
  rpc Deployments(QueryDeploymentsRequest) returns (QueryDeploymentsResponse) {
    option (google.api.http).get = "/akash/deployment/v1beta3/deployments/list";
  }

  // Deployment queries deployment details
  rpc Deployment(QueryDeploymentRequest) returns (QueryDeploymentResponse) {
    option (google.api.http).get = "/akash/deployment/v1beta3/deployments/info";
  }

  // Group queries group details
  rpc Group(QueryGroupRequest) returns (QueryGroupResponse) {
    option (google.api.http).get = "/akash/deployment/v1beta3/groups/info";
  }
}

// QueryDeploymentsRequest is request type for the Query/Deployments RPC method
message QueryDeploymentsRequest {
  DeploymentFilters filters = 1 [
    (gogoproto.nullable) = false
  ];

  cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// QueryDeploymentsResponse is response type for the Query/Deployments RPC method
message QueryDeploymentsResponse {
  repeated QueryDeploymentResponse deployments = 1 [
    (gogoproto.nullable) = false,
    (gogoproto.castrepeated) = "DeploymentResponses"
  ];

  cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryDeploymentRequest is request type for the Query/Deployment RPC method
message QueryDeploymentRequest {
  DeploymentID id = 1 [
    (gogoproto.nullable) = false,
    (gogoproto.customname) = "ID"
  ];
}

// QueryDeploymentResponse is response type for the Query/Deployment RPC method
message QueryDeploymentResponse {
  option (gogoproto.equal)            = false;
  Deployment deployment = 1 [
    (gogoproto.nullable) = false,
    (gogoproto.jsontag) = "deployment",
    (gogoproto.moretags) = "yaml:\"deployment\""
  ];
  repeated Group groups = 2 [
    (gogoproto.nullable) = false,
    (gogoproto.jsontag) = "groups",
    (gogoproto.moretags) = "yaml:\"groups\""
  ];
  akash.escrow.v1beta3.Account escrow_account = 3 [
    (gogoproto.nullable) = false
  ];
}

// QueryGroupRequest is request type for the Query/Group RPC method
message QueryGroupRequest {
  GroupID id = 1 [
    (gogoproto.nullable) = false,
    (gogoproto.customname) = "ID"
  ];
}

// QueryGroupResponse is response type for the Query/Group RPC method
message QueryGroupResponse {
  Group group = 1 [
    (gogoproto.nullable) = false
  ];
}
