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

import "gogoproto/gogo.proto";
import "akash/market/v1beta2/order.proto";
import "cosmos/base/v1beta1/coin.proto";

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

// MsgCreateBid defines an SDK message for creating Bid
message MsgCreateBid {
  option (gogoproto.equal) = false;

  OrderID order = 1 [
    (gogoproto.customname) = "Order",
    (gogoproto.nullable)   = false,
    (gogoproto.jsontag)    = "order",
    (gogoproto.moretags)   = "yaml:\"order\""
  ];
  string                   provider = 2 [(gogoproto.jsontag) = "provider", (gogoproto.moretags) = "yaml:\"provider\""];
  cosmos.base.v1beta1.DecCoin price    = 3
      [(gogoproto.nullable) = false, (gogoproto.jsontag) = "price", (gogoproto.moretags) = "yaml:\"price\""];

  cosmos.base.v1beta1.Coin deposit = 4
      [(gogoproto.nullable) = false, (gogoproto.jsontag) = "deposit", (gogoproto.moretags) = "yaml:\"deposit\""];
}

// MsgCreateBidResponse defines the Msg/CreateBid response type.
message MsgCreateBidResponse {}

// MsgCloseBid defines an SDK message for closing bid
message MsgCloseBid {
  option (gogoproto.equal) = false;

  BidID bid_id = 1 [
    (gogoproto.customname) = "BidID",
    (gogoproto.nullable)   = false,
    (gogoproto.jsontag)    = "id",
    (gogoproto.moretags)   = "yaml:\"id\""
  ];
}

// MsgCloseBidResponse defines the Msg/CloseBid response type.
message MsgCloseBidResponse {}

// BidID stores owner and all other seq numbers
// A successful bid becomes a Lease(ID).
message BidID {
  option (gogoproto.equal)            = false;
  option (gogoproto.goproto_stringer) = false;

  string owner = 1 [(gogoproto.jsontag) = "owner", (gogoproto.moretags) = "yaml:\"owner\""];
  uint64 dseq  = 2
      [(gogoproto.customname) = "DSeq", (gogoproto.jsontag) = "dseq", (gogoproto.moretags) = "yaml:\"dseq\""];
  uint32 gseq = 3
      [(gogoproto.customname) = "GSeq", (gogoproto.jsontag) = "gseq", (gogoproto.moretags) = "yaml:\"gseq\""];
  uint32 oseq = 4
      [(gogoproto.customname) = "OSeq", (gogoproto.jsontag) = "oseq", (gogoproto.moretags) = "yaml:\"oseq\""];
  string provider = 5 [(gogoproto.jsontag) = "provider", (gogoproto.moretags) = "yaml:\"provider\""];
}

// Bid stores BidID, state of bid and price
message Bid {
  option (gogoproto.equal)            = false;
  option (gogoproto.goproto_stringer) = false;

  BidID bid_id = 1 [
    (gogoproto.customname) = "BidID",
    (gogoproto.nullable)   = false,
    (gogoproto.jsontag)    = "id",
    (gogoproto.moretags)   = "yaml:\"id\""
  ];

  // State is an enum which refers to state of bid
  enum State {
    option (gogoproto.goproto_enum_prefix) = false;

    // Prefix should start with 0 in enum. So declaring dummy state
    invalid = 0 [(gogoproto.enumvalue_customname) = "BidStateInvalid"];
    // BidOpen denotes state for bid open
    open = 1 [(gogoproto.enumvalue_customname) = "BidOpen"];
    // BidMatched denotes state for bid open
    active = 2 [(gogoproto.enumvalue_customname) = "BidActive"];
    // BidLost denotes state for bid lost
    lost = 3 [(gogoproto.enumvalue_customname) = "BidLost"];
    // BidClosed denotes state for bid closed
    closed = 4 [(gogoproto.enumvalue_customname) = "BidClosed"];
  }

  State                    state = 2 [(gogoproto.jsontag) = "state", (gogoproto.moretags) = "yaml:\"state\""];
  cosmos.base.v1beta1.DecCoin price = 3
      [(gogoproto.nullable) = false, (gogoproto.jsontag) = "price", (gogoproto.moretags) = "yaml:\"price\""];
  int64 created_at = 4;
}

// BidFilters defines flags for bid list filter
message BidFilters {
  option (gogoproto.equal) = false;

  string owner = 1 [(gogoproto.jsontag) = "owner", (gogoproto.moretags) = "yaml:\"owner\""];
  uint64 dseq  = 2
      [(gogoproto.customname) = "DSeq", (gogoproto.jsontag) = "dseq", (gogoproto.moretags) = "yaml:\"dseq\""];
  uint32 gseq = 3
      [(gogoproto.customname) = "GSeq", (gogoproto.jsontag) = "gseq", (gogoproto.moretags) = "yaml:\"gseq\""];
  uint32 oseq = 4
      [(gogoproto.customname) = "OSeq", (gogoproto.jsontag) = "oseq", (gogoproto.moretags) = "yaml:\"oseq\""];
  string provider = 5 [(gogoproto.jsontag) = "provider", (gogoproto.moretags) = "yaml:\"provider\""];
  string state    = 6 [(gogoproto.jsontag) = "state", (gogoproto.moretags) = "yaml:\"state\""];
}
