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

// TaobaoSKUInfo - taobao sku infomation
message TaobaoSKUInfo {
    string skuid = 1;
    float price = 2;
    string title = 3;
    string img = 4;
    int32 stock = 5;
    string valueid = 6;
    string itemid = 7;
}

// TaobaoShopInfo - taobao shop infomation
message TaobaoShopInfo {
    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;
}

// TaobaoProductHistory - taobao product history
message TaobaoProductHistory {
    repeated TaobaoSKUInfo skus = 1;
    int64 lastUpdatedTime = 2;
}

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

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

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

// TaobaoProduct - taobao product
message TaobaoProduct {
    string itemID = 1;
    repeated TaobaoSKUInfo skus = 2;
    string title = 3;
    int32 reviews = 4;
    int64 lastUpdatedTime = 5;
    repeated string attributes = 6;
    TaobaoShopInfo shop = 7;
    int32 salesVolume = 8;          // 月销量
    repeated string pay = 9;        // 支付列表，譬如信用卡等
    repeated string service = 10;   // 服务承诺列表，譬如7天无理由退换等
    string wl = 11;                 // 物流服务
    repeated TaobaoProductHistory lstHistory = 12;
    string rootCategoryID = 13;
    string categoryID = 14;
    string tbItemID = 15;
    string brandValueID = 16;
    int32 favCount = 17;
    repeated string imgs = 18;
    repeated TaobaoProperty props = 19;
    repeated TaobaoReviewTag reviewTags = 20;
    float price = 21;
    repeated TaobaoRelatedItem relatedItems = 22;
}

// TaobaoItem - taobao item
message TaobaoItem {
    string itemID = 1;
    string title = 2;
    string img = 3;
    string url = 4;
    string shopname = 5;
    string shopid = 6;
    string shopurl = 7;
    float price = 8;
    int32 deal = 9;
    repeated string icons = 10;
    string location = 11;
    bool isAD = 12;
    string strDeal = 13;
}

// TaobaoSearchResult - taobao search result
message TaobaoSearchResult {
    repeated TaobaoItem items = 1;
    string text = 2;
    int64 lastUpdatedTime = 3;
}

// TaobaoMode - taobao mode
enum TaobaoMode {
    // TBM_PRODUCT - product
    TBM_PRODUCT = 0;
    // TBM_SEARCH - search
    TBM_SEARCH = 1;
    // TBM_MOBILEPRODUCT - mobile product
    TBM_MOBILEPRODUCT = 2;
}

// RequestTaobao - request taobao
message RequestTaobao {
    TaobaoMode mode = 1;
    string itemID = 2;
    string text = 3;
    string device = 4;
}

// ReplyTaobao - reply taobao
message ReplyTaobao {
    TaobaoMode mode = 1;

    oneof reply {
        TaobaoProduct product = 100;
        TaobaoSearchResult searchResult = 101;
    }    
}