import "common_base.proto";

message CAuction_Bid {
	optional uint32 accountid = 1;
	optional uint64 auctiondescriptionid = 2;
	optional int32 state = 3 [(.description) = "enum"];
	optional uint32 time_created = 4;
	optional uint32 time_updated = 5;
	optional int64 amount_bid = 6;
	optional int64 amount_paid = 7;
	optional int64 auctionbidid = 8;
}

message CAuction_CancelBid_Request {
	optional uint64 auctiondescriptionid = 1;
}

message CAuction_CancelBid_Response {
	optional int64 amount_returned = 1;
}

message CAuction_GetAllItems_Request {
}

message CAuction_GetAllItems_Response {
	repeated .CAuction_Item items = 1;
}

message CAuction_GetBidsForItem_Request {
	optional uint64 auctiondescriptionid = 1;
}

message CAuction_GetBidsForItem_Response {
	optional .CAuction_Item item = 1;
	optional int32 count_total = 2;
	optional int32 current_user_position = 3;
	repeated .CAuction_Bid winning_bids = 4;
}

message CAuction_GetBidsForUser_Request {
	optional fixed64 steamid = 1;
}

message CAuction_GetBidsForUser_Response {
	repeated .CAuction_Bid bids = 1;
}

message CAuction_GetItemDetails_Request {
	optional uint64 auctiondescriptionid = 1;
}

message CAuction_GetItemDetails_Response {
	optional .CAuction_Item item = 1;
}

message CAuction_GetUserBidForItem_Request {
	optional uint64 auctiondescriptionid = 1;
}

message CAuction_GetUserBidForItem_Response {
	optional .CAuction_Bid bid = 1;
}

message CAuction_Item {
	optional uint64 auctiondescriptionid = 1;
	optional uint32 time_start = 2;
	optional uint32 time_end = 3;
	optional int64 amount_total = 5;
	optional int64 amount_remaining = 6;
	optional int64 highest_amount = 7;
	optional uint32 highest_bidder_accountid = 8;
	optional uint32 community_item_appid = 9;
	optional uint32 community_item_type = 10;
	optional uint32 store_appid = 11;
	repeated uint32 store_packageids = 12;
	optional int64 reserve_price = 13;
}

message CAuction_PlaceBid_Request {
	optional uint64 auctiondescriptionid = 1;
	optional int64 amount_bid = 2;
	optional int32 expected_amount_remaining = 3;
}

message CAuction_PlaceBid_Response {
}

service Auction {
	// ePrivilege=1
	rpc CancelBid (.CAuction_CancelBid_Request) returns (.CAuction_CancelBid_Response);
	// bConstMethod=true, ePrivilege=0
	rpc GetAllItems (.CAuction_GetAllItems_Request) returns (.CAuction_GetAllItems_Response);
	// bConstMethod=true, ePrivilege=2, eWebAPIKeyRequirement=1
	rpc GetBidsForItem (.CAuction_GetBidsForItem_Request) returns (.CAuction_GetBidsForItem_Response);
	// bConstMethod=true, ePrivilege=1
	rpc GetBidsForUser (.CAuction_GetBidsForUser_Request) returns (.CAuction_GetBidsForUser_Response);
	// bConstMethod=true, ePrivilege=2, eWebAPIKeyRequirement=1
	rpc GetItemDetails (.CAuction_GetItemDetails_Request) returns (.CAuction_GetItemDetails_Response);
	// bConstMethod=true, ePrivilege=1
	rpc GetUserBidForItem (.CAuction_GetUserBidForItem_Request) returns (.CAuction_GetUserBidForItem_Response);
	// ePrivilege=3
	rpc PlaceBid (.CAuction_PlaceBid_Request) returns (.CAuction_PlaceBid_Response);
}

