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

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "akash/market/v1beta3/order.proto";
import "akash/market/v1beta3/bid.proto";
import "akash/market/v1beta3/lease.proto";
import "akash/escrow/v1beta3/types.proto";

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

// Query defines the gRPC querier service
service Query {
  // Orders queries orders with filters
  rpc Orders(QueryOrdersRequest) returns (QueryOrdersResponse) {
    option (google.api.http).get = "/akash/market/v1beta3/orders/list";
  }

  // Order queries order details
  rpc Order(QueryOrderRequest) returns (QueryOrderResponse) {
    option (google.api.http).get = "/akash/market/v1beta3/orders/info";
  }

  // Bids queries bids with filters
  rpc Bids(QueryBidsRequest) returns (QueryBidsResponse) {
    option (google.api.http).get = "/akash/market/v1beta3/bids/list";
  }

  // Bid queries bid details
  rpc Bid(QueryBidRequest) returns (QueryBidResponse) {
    option (google.api.http).get = "/akash/market/v1beta3/bids/info";
  }

  // Leases queries leases with filters
  rpc Leases(QueryLeasesRequest) returns (QueryLeasesResponse) {
    option (google.api.http).get = "/akash/market/v1beta3/leases/list";
  }

  // Lease queries lease details
  rpc Lease(QueryLeaseRequest) returns (QueryLeaseResponse) {
    option (google.api.http).get = "/akash/market/v1beta3/leases/info";
  }
}

// QueryOrdersRequest is request type for the Query/Orders RPC method
message QueryOrdersRequest {
  OrderFilters filters = 1 [
    (gogoproto.nullable) = false
  ];

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

// QueryOrdersResponse is response type for the Query/Orders RPC method
message QueryOrdersResponse {
  repeated Order orders = 1 [
    (gogoproto.nullable) = false,
    (gogoproto.castrepeated) = "Orders"
  ];

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

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

// QueryOrderResponse is response type for the Query/Order RPC method
message QueryOrderResponse {
  Order order = 1 [
    (gogoproto.nullable) = false
  ];
}

// QueryBidsRequest is request type for the Query/Bids RPC method
message QueryBidsRequest {
  BidFilters filters = 1 [
    (gogoproto.nullable) = false
  ];

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

// QueryBidsResponse is response type for the Query/Bids RPC method
message QueryBidsResponse {
  repeated QueryBidResponse bids = 1 [
    (gogoproto.nullable) = false
  ];

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

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

// QueryBidResponse is response type for the Query/Bid RPC method
message QueryBidResponse {
  Bid bid = 1 [(gogoproto.nullable) = false];
  akash.escrow.v1beta3.Account escrow_account = 2 [
    (gogoproto.nullable) = false
  ];
}

// QueryLeasesRequest is request type for the Query/Leases RPC method
message QueryLeasesRequest {
  LeaseFilters filters = 1 [
    (gogoproto.nullable) = false
  ];

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

// QueryLeasesResponse is response type for the Query/Leases RPC method
message QueryLeasesResponse {
  repeated QueryLeaseResponse leases = 1 [
    (gogoproto.nullable) = false
  ];

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

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

// QueryLeaseResponse is response type for the Query/Lease RPC method
message QueryLeaseResponse {
  Lease lease = 1 [(gogoproto.nullable) = false];
  akash.escrow.v1beta3.FractionalPayment escrow_payment = 2 [
    (gogoproto.nullable) = false
  ];
}
