syntax = "proto3";

package rewards;

service RewardsService {
	rpc getRewardsFromRedeem (getRewardsFromRedeemInput) returns (getRewardsFromRedeemOutput) {}
	rpc depleteRewardsStock (depleteRewardsStockInput) returns (empty) {}
	rpc cancelRewardStockDepletion (cancelRewardStockDepletionInput) returns (empty) {}
}

service RewardsController {
	rpc getRewards (getRewardsInput) returns (getRewardsOutput) {}
	rpc getRewardsByProgram (getRewardsByProgramInput) returns (getRewardsOutput) {}
}

message getRewardsFromRedeemInput{
  repeated getRewardsFromRedeemItemInput rewards = 1;
}
message getRewardsFromRedeemOutput{
  repeated getRewardsFromRedeemItemOutput rewards = 1;
}

message getRewardsFromRedeemItemInput {
  string id = 1;
}

message getRewardsFromRedeemItemOutput {
  string id = 1;
	string name = 2;
	float score = 3;
	int32 stock = 4;
	int32 redeemTimes = 5;
	int32 redeemDelay = 6;
}

message depleteRewardsStockInput {
	repeated depleteRewardsStockItemInput rewards = 1;
}

message depleteRewardsStockItemInput {
	string id = 1;
	int32 quantity  = 2;
	string redeemId = 3;
}

message cancelRewardStockDepletionInput {
	string redeemId = 1;
}

message getRewardsInput {
	int32 take = 1;
	int32 skip = 2;
	string programId = 3;
	string search = 4;
	string status = 5;
	string type = 6;
	float scoreUpTo = 7;
	repeated string categoryIds = 8;
	string customerCategoryId = 9;
	string retrieveAll = 10;
	string storeId = 11;
}

message getRewardsByProgramInput {
	int32 take = 1;
	int32 skip = 2;
	string programId = 3;
	string search = 4;
	string status = 5;
	string type = 6;
	float scoreUpTo = 7;
	repeated string categoryIds = 8;
	string customerCategoryId = 9;
	string retrieveAll = 10;
}

message getRewardsOutput {
	repeated getRewardsDataOutput data = 1;
	int32 count = 2;
}

message getRewardsDataOutput {
	string id = 1;
	string type = 2;
	string name = 3;
	string description = 4;
	string imageUrl = 5;
	float requiredScore = 6;
	string redeemMethod = 7;
	string storeId = 8;
	string programId = 9;
	int32 stock = 10;
	string rewardHash = 11;
	string status = 12;
	repeated getRewardsCustomerCategoryOutput customersCategory = 13;
	getRewardsCategoryOutput category = 14;
	string partnerId = 15;
	string refRewardId = 16;
	int32 redeemTimes = 17;
	int32 redeemDelay = 18;

}

message getRewardsCustomerCategoryOutput {
	string id = 1;
	string customerCategoryId = 2;
	string rewardsId = 3;
}

message getRewardsCategoryOutput {
	string id = 1;
	string name = 2;
	string icon = 3;
	string isDefault = 4;
	string status = 5;
	string redeemBy = 6;
	string storeId = 7;
	string programId = 8;
}

message empty {

}