syntax = "proto3";
package jarviscrawlercore;
option go_package = "github.com/zhs007/jccclient/pb";

// TmallSKUInfo - tmall sku infomation
message TmallSKUInfo {
    string skuid = 1;
    float price = 2;
    string title = 3;
    string img = 4;
    int32 stock = 5;
    float originalPrice = 6;
    string wl = 7;
    float wlPrice = 8;
    string wlStr = 9;
    string itemid = 10;
}

// TmallProductHistory - tmall sku infomation
message TmallProductHistory {
    repeated TmallSKUInfo skus = 1;
    int64 lastUpdatedTime = 2;
}

// TmallReviewTag - tmall review tag
message TmallReviewTag {
    string tag = 1;
    int32 times = 2;
    int32 type = 3;
}

// TmallShopInfo - tmall shop infomation
message TmallShopInfo {
    string name = 1;
    bool gold = 2;
    string url = 3;
    string rank = 4;    // cap/gold ...
    int32 rating = 5;   // 3/4/5 ...
    repeated int32 rateLevel = 6;   // 描述、服务、物流，-1表示低，0表示等于，1表示高
    repeated float rateScore = 7;   // 描述、服务、物流，具体分数
    string shopid = 8;
    string userid = 9;
    int32 creditLevel = 10;
    int32 allItemCount = 11;
    int32 newItemCount = 12;
    string strFans = 13;
    float goodRatePercentage = 14;
    repeated float rateOffset = 15;
}

// TmallProperty - tmall property
message TmallProperty {
    int32 rootIndex = 1;
    string rootName = 2;
    string key = 3;
    string value = 4;
}

message TmallRelatedItem {
    string itemID = 1;
    string url = 2;
    string name = 3;
    bool isCurrent = 4;
}

// TmallProduct - tmall product
message TmallProduct {
    string itemID = 1;
    repeated TmallSKUInfo skus = 2;
    string brand = 3;
    string brandID = 4;
    string categoryID = 5;
    string title = 6;
    string newinfo = 7;
    int32 reviews = 8;
    float rating = 9;
    repeated TmallReviewTag reviewTags = 10;
    int64 lastUpdatedTime = 11;
    int32 sellCount = 12;
    string strSellCount = 13;
    repeated TmallProductHistory lstHistory = 14;
    string rootCategoryID = 15;
    string tbItemID = 16;
    string brandValueID = 17;
    int32 favCount = 18;
    repeated string imgs = 19;
    TmallShopInfo shop = 20;
    repeated TmallProperty props = 21;
    float price = 22;
    repeated TmallRelatedItem relatedItems = 23;
}

// TmallMode - tmall mode
enum TmallMode {
    // TMM_PRODUCT - product
    TMM_PRODUCT = 0;
    // TMM_MOBILEPRODUCT - mobile product
    TMM_MOBILEPRODUCT = 1;
}

// RequestTmall - request tmall
message RequestTmall {
    TmallMode mode = 1;
    string url = 2;
    string device = 3;
}

// ReplyTmall - reply tmall
message ReplyTmall {
    TmallMode mode = 1;

    oneof reply {
        TmallProduct product = 100;
    }    
}