syntax = "proto3";

import "google/protobuf/timestamp.proto";
package code.justin.tv.commerce.pachter;

option go_package = "pachter";

service Pachter {
    rpc HealthCheck (HealthCheckReq) returns (HealthCheckResp) {};

    rpc GetBitsMonthlyReport (GetBitsMonthlyReportReq) returns (GetBitsMonthlyReportResp) {};
    rpc GetEmoteUsageMonthlyReport (GetEmoteUsageMonthlyReportReq) returns (GetEmoteUsageMonthlyReportResp) {};
    rpc GetBitsMonthlyAmountsForAllChannels (GetBitsMonthlyAmountsForAllChannelsReq) returns (GetBitsMonthlyAmountsForAllChannelsResp) {};
    rpc GetBitsAmountsForChannel (GetBitsAmountsForChannelReq) returns (GetBitsAmountsForChannelResp) {};

    rpc GetActuals (GetActualsReq) returns (GetActualsResp) {};
    rpc SetActuals (SetActualsReq) returns (SetActualsResp) {};

    rpc GetBitsSpendOrder (GetBitsSpendOrderReq) returns (GetBitsSpendOrderResp) {};
}

message HealthCheckReq {}

message HealthCheckResp{}

message GetBitsMonthlyReportReq {
    uint32 month = 1;
    uint32 year = 2;
}

message GetBitsMonthlyReportResp {
    string report_url = 1;
}

message GetEmoteUsageMonthlyReportReq {
    uint32 month = 1;
    uint32 year = 2;
}

message GetEmoteUsageMonthlyReportResp {
    string report_url = 1;
}

message GetActualsReq {
    Platform platform = 1;
    uint32 month = 2;
    uint32 year = 3;
}

message GetBitsMonthlyAmountsForAllChannelsReq {
    uint32 month = 1;
    uint32 year = 2;
}

message GetBitsMonthlyAmountsForAllChannelsResp {
    map<string, uint32> bits_amounts = 1;
}

message GetBitsAmountsForChannelReq {
    string channel_id = 1;
    google.protobuf.Timestamp start_date = 2;
    google.protobuf.Timestamp end_date = 3;
    Period period = 4;
}

enum Period {
    HOUR = 0;
    DAY = 1;
    WEEK = 2;
    MONTH = 3;
    YEAR = 4;
}

message GetBitsAmountsForChannelResp {
    repeated BitsPeriodAmount bits_amounts = 1;
}

message BitsPeriodAmount {
    google.protobuf.Timestamp time = 1;
    uint32 amount = 2;
}

message GetActualsResp {
    map<string, uint32> actuals = 1;
}

message SetActualsReq {
    Platform platform = 1;
    uint32 month = 2;
    uint32 year = 3;
    map<string, uint32> actuals = 4;
}

message SetActualsResp {
}

message GetBitsSpendOrderReq {
    string transaction_id = 1;
}

message GetBitsSpendOrderResp {
    map<string, uint32> bits_types = 1;
}

// import public "vendor/code.justin.tv/commerce/petozi/rpc/petozi-service.proto";
// I tried importnig this from Petozi with the above lines, but it freaked protobuf out to have two health checks,
// even though they were in a different package.
enum Platform {
    NONE    = 0;
    AMAZON  = 1;
    PAYPAL  = 2;
    IOS     = 3;
    ANDROID = 4;
    XSOLLA  = 5;
    PHANTO  = 6;
}
