syntax = "proto3";

package code.justin.tv.commerce.mako.dashboard;
option go_package = "mako-dashboard";


service Mako {

    // Get the emote groups details for the given emote group ids.
    // This API uses uncached code paths to serve accurate data in real-time, which may affect performance.
    rpc GetEmotesByGroups(GetEmotesByGroupsRequest) returns (GetEmotesByGroupsResponse);

    // Get emote image/upload id(s) and url(s).
    rpc GetEmoteUploadConfig(GetEmoteUploadConfigRequest) returns (GetEmoteUploadConfigResponse);
}

// Request Types

message GetEmotesByGroupsRequest {
    repeated string emote_group_ids = 1;
    EmoteFilter filter = 2;
}

// Response Types

message GetEmotesByGroupsResponse {
    repeated EmoteGroup groups = 1;
}

// Data Types

// An Emote Group contains a list of emotes tied to that emote group.
message EmoteGroup {
    string id = 1;
    repeated Emote emotes = 2;
}

// An EmoteFilter specifies a filter that will be applied to the underlying emotes before the response is created.
message EmoteFilter {
    Domain domain = 2;
    repeated EmoteState states = 3;
}

// An Emote has an identifier and a code used in clients.
message Emote {
    string id = 1;
    string code = 2;
    string group_id = 3;
    string owner_id = 4;
    EmoteState state = 5;
    Domain domain = 6;
    string suffix = 7;
}

// A Domain specifies what type of asset this is.
enum Domain {
    emotes = 0;
}

// An EmoteState specifies the current state of the emote.
enum EmoteState {
    active = 0;
    inactive = 1;
    moderated = 2;
    pending = 3;
    archived = 4;
}

message GetEmoteUploadConfigRequest {
    string user_id = 1;
    ResizePlan resize_plan = 2;
    repeated EmoteImageSize sizes = 3;
}

message GetEmoteUploadConfigResponse {
    repeated EmoteUploadConfig upload_configs = 1;
}

message EmoteUploadConfig {
    string id = 1;
    EmoteImageSize size = 2;
    string url = 3;
    repeated EmoteImage images = 4;
}

message EmoteImage {
    string id = 1;
    EmoteImageSize size = 2;
    string url = 3;
}

enum EmoteImageSize {
    size_original = 0;
    size_1x = 1;
    size_2x = 2;
    size_4x = 3;
}

enum ResizePlan {
    no_resize = 0;
    auto_resize = 1;
}