import "mapreduce/yt/interface/protos/extension.proto";

package NWebmaster.NProto;

enum EHost2VecSource {
    HOST_2_VEC_SPY_LOG = 1;
    HOST_2_VEC_SIMILAR_GROUP = 2;
};

message TMirror {
    optional string Host        = 1 [(NYT.column_name) = "Host"];
    optional string MainHost    = 2 [(NYT.column_name) = "MainHost"];
    optional uint64 Rank        = 3 [(NYT.column_name) = "Rank"];
}

message TAddedRival {
    optional string Host            = 1 [(NYT.column_name) = "Host"];
    optional string RivalOwner      = 2 [(NYT.column_name) = "RivalOwner"];
    optional string MainHost        = 3 [(NYT.column_name) = "MainHost"];
    optional bool IsMainRivalHost   = 4 [(NYT.column_name) = "IsMainRivalHost"];
}

message TRivalAnalogy {
    optional string MainHost            = 1 [(NYT.column_name) = "MainHost"];
    optional string Host                = 2 [(NYT.column_name) = "Host"];
    optional EHost2VecSource Source     = 3 [(NYT.column_name) = "Source", (NYT.flags) = ENUM_INT];
    optional uint32 RivalCount          = 4 [(NYT.column_name) = "RivalCount"];
    optional uint32 RivalOwnerCount     = 5 [(NYT.column_name) = "RivalOwnerCount"];
}

message TRival {
    optional string MainHost            = 1 [(NYT.column_name) = "MainHost"];
    optional string Host                = 2 [(NYT.column_name) = "Host"];
    optional uint64 RivalSourceFlag     = 3 [(NYT.column_name) = "RivalSourceFlag"];
    optional uint64 RivalCount          = 4 [(NYT.column_name) = "RivalCount"];
    optional uint64 AvailableSource     = 6 [(NYT.column_name) = "AvailableSource"];
    optional uint64 RivalCountThreshold = 7 [(NYT.column_name) = "MinRivalCount"];
    optional double QueryRivalThreshold = 8 [(NYT.column_name) = "QueryRivalThreshold"];
}

message TRivalHostQuery {
    optional string Host                =  2 [(NYT.column_name) = "Host"];
    optional string Query               =  3 [(NYT.column_name) = "Query"];
    optional string Path                =  4 [(NYT.column_name) = "Path"];
    optional double Cm2                 =  5 [(NYT.column_name) = "Cm2"];
    optional uint64 TableSource         =  6 [(NYT.column_name) = "TableSource"];
    optional uint64 RegionId            =  7 [(NYT.column_name) = "RegionId"];
    optional uint64 Position            =  8 [(NYT.column_name) = "Position"];
    optional uint64 Count               =  9 [(NYT.column_name) = "Count"];
    optional int64 InvCount             =  10 [(NYT.column_name) = "InvCount"];
}

message TRivalHostQueryExtended {
    optional string MainHost            =  1 [(NYT.column_name) = "MainHost"];
    optional string Host                =  2 [(NYT.column_name) = "Host"];
    optional string Query               =  3 [(NYT.column_name) = "Query"];
    optional string Path                =  4 [(NYT.column_name) = "Path"];
    optional double Cm2                 =  5 [(NYT.column_name) = "Cm2"];
    optional uint64 TableSource         =  6 [(NYT.column_name) = "TableSource"];
    optional uint64 RegionId            =  7 [(NYT.column_name) = "RegionId"];
    optional uint64 Position            =  8 [(NYT.column_name) = "Position"];
    optional uint64 Count               =  9 [(NYT.column_name) = "Count"];
    optional uint64 RivalSourceFlag     = 10 [(NYT.column_name) = "RivalSourceFlag"];
    optional uint64 RivalCount          = 11 [(NYT.column_name) = "RivalCount"];
    optional uint64 RivalOwnerCount     = 12 [(NYT.column_name) = "RivalOwnerCount"];
    optional uint64 AvailableSource     = 13 [(NYT.column_name) = "AvailableSource"];
    optional uint64 RivalCountThreshold = 14 [(NYT.column_name) = "MinRivalCount"];
    optional double QueryRivalThreshold = 15 [(NYT.column_name) = "QueryRivalThreshold"];
}


message THostQuery {
    optional string Host            = 1 [(NYT.column_name) = "Host"];
    optional string Query           = 2 [(NYT.column_name) = "Query"]; 
    optional uint64 Count           = 3 [(NYT.column_name) = "Count"];
    optional int64 RivalCount       = 4 [(NYT.column_name) = "RivalCount"];
    optional int64 OwnerCount       = 5 [(NYT.column_name) = "OwnerCount"];
    optional int64 InvCount         = 6 [(NYT.column_name) = "InvCount"];
    optional uint64 SourceFlag      = 7 [(NYT.column_name) = "SourceFlag"];
    optional double Share           = 8 [(NYT.column_name) = "Share"];
}

message THostQueryImport {
    optional string Host            = 1 [(NYT.column_name) = "Host"];
    optional string Query           = 2 [(NYT.column_name) = "Query"]; 
    optional uint64 SourceFlag      = 3 [(NYT.column_name) = "SourceFlag"];
    optional uint64 RegionId        = 4 [(NYT.column_name) = "RegionId"];
    optional bool IsMobile          = 5 [(NYT.column_name) = "IsMobile"];
    optional bool IsPad             = 6 [(NYT.column_name) = "IsPad"];
    optional uint64 Count           = 7 [(NYT.column_name) = "Count"];
    optional double Share           = 8 [(NYT.column_name) = "Share"];

    optional double UpperQueryNavPredAvg = 9 [(NYT.column_name) = "UpperQueryNavPredAvg"];
    optional double UpperQueryNavPredMax = 10 [(NYT.column_name) = "UpperQueryNavPredMax"];
    optional double UpperDocNavPred0Avg = 11 [(NYT.column_name) = "UpperDocNavPred0Avg"];
    optional double UpperDocNavPred0Max = 12 [(NYT.column_name) = "UpperDocNavPred0Max"];
    optional double ClicksAvg = 13 [(NYT.column_name) = "ClicksAvg"];
    optional double ClicksMax = 14 [(NYT.column_name) = "ClicksMax"];
    optional double ShowsAvg = 15 [(NYT.column_name) = "ShowsAvg"];
    optional double ShowsMax = 16 [(NYT.column_name) = "ShowsMax"];
    optional double Cm2Avg = 17 [(NYT.column_name) = "Cm2Avg"];
    optional double Cm2Max = 18 [(NYT.column_name) = "Cm2Max"];
    optional double UpperPornoUpperPl = 19 [(NYT.column_name) = "UpperPornoUpperPl"];
}

message THostQueryPosition {
    optional string Host            = 1 [(NYT.column_name) = "Host"];
    optional string Query           = 2 [(NYT.column_name) = "Query"];  
    optional uint64 RegionId        = 3 [(NYT.column_name) = "RegionId"];
    optional uint64 TableSource     = 4 [(NYT.column_name) = "TableSource"];
    optional double Position        = 5 [(NYT.column_name) = "Position"];
}


message TFavoriteQuery {
    optional string Host    = 1 [(NYT.column_name) = "Host"];
    optional string Query   = 2 [(NYT.column_name) = "Query"];
}

message THostSettings {
    optional string Host                = 1 [(NYT.column_name) = "Host"];
    optional uint64 MaxRivalQueryCount  = 2 [(NYT.column_name) = "MaxRivalQueryCount"];
    optional uint64 AvailableSource     = 3 [(NYT.column_name) = "AvailableSource"];
    optional uint64 RivalCountThreshold = 4 [(NYT.column_name) = "MinRivalCount"];
    optional double QueryRivalThreshold = 5 [(NYT.column_name) = "QueryRivalThreshold"];
}

message TRivalQueryStatisticInfo {
    optional string Host                = 1 [(NYT.column_name) = "Host"];
    optional string Query               = 2 [(NYT.column_name) = "Query"];
    optional uint64 RegionId            = 3 [(NYT.column_name) = "RegionId"];
    optional double Position            = 4 [(NYT.column_name) = "Position"];
    optional uint64 QuerySourceFlag     = 5 [(NYT.column_name) = "QuerySource"];
}

message TUserSessionQueryCountStat {
    optional string Host                = 1 [(NYT.column_name) = "Host"];
    optional string Query               = 2 [(NYT.column_name) = "Query"];
    optional uint64 RegionId            = 3 [(NYT.column_name) = "RegionId"];
    optional bool IsMobile              = 4 [(NYT.column_name) = "IsMobile"];
    optional bool IsPad                 = 5 [(NYT.column_name) = "IsPad"];
    optional double Position            = 6 [(NYT.column_name) = "Position"];
    optional uint64 Count               = 7 [(NYT.column_name) = "Count"];
    optional double ClickPositionShare  = 8 [(NYT.column_name) = "ClickPositionShare"];
    optional double Popularity          = 9 [(NYT.column_name) = "Popularity"];
}

message TUserSessionIntersecQuery {
    optional string MainHost            =  1 [(NYT.column_name) = "MainHost"];
    optional string Host                =  2 [(NYT.column_name) = "Host"];
    optional string Query               =  3 [(NYT.column_name) = "Query"];
    optional uint64 RegionId            =  4 [(NYT.column_name) = "RegionId"];
    optional bool IsMobile              =  5 [(NYT.column_name) = "IsMobile"];
    optional bool IsPad                 =  6 [(NYT.column_name) = "IsPad"];
    optional double Position            =  7 [(NYT.column_name) = "Position"];
    optional uint64 Count               =  8 [(NYT.column_name) = "Count"];
    optional uint64 QuerySourceFlag     =  9 [(NYT.column_name) = "QuerySource"];
    optional double ClickPositionShare  = 10 [(NYT.column_name) = "ClickPositionShare"];
    optional double Popularity          = 11 [(NYT.column_name) = "Popularity"];
    optional double Share               = 12 [(NYT.column_name) = "Share"];
}

message TRivalHostQueryCount {
    optional string MainHost            = 1 [(NYT.column_name) = "MainHost"];
    optional string Host                = 2 [(NYT.column_name) = "Host"];
    optional double Count                = 8 [(NYT.column_name) = "Count"];
    optional double InvCount             = 9 [(NYT.column_name) = "InvCount"];
}

message TSelectedRival {
    optional string Host                = 1 [(NYT.column_name) = "Host"];
    optional string Rival               = 2 [(NYT.column_name) = "Rival"];
}


message TQueryPopularity {
    optional string Query               = 1 [(NYT.column_name) = "Query"];
    optional uint64 Popularity          = 2 [(NYT.column_name) = "Popularity"];
    optional uint64 RegionId            = 3 [(NYT.column_name) = "RegionId"];
    optional bool IsMobile              = 4 [(NYT.column_name) = "IsMobile"];
    optional bool IsPad                 = 5 [(NYT.column_name) = "IsPad"];

    // optional double IsNavAvg            = 6 [(NYT.column_name) = "IsNavAvg"];
    optional double UpperQueryNavPredAvg = 7 [(NYT.column_name) = "UpperQueryNavPredAvg"];
    optional double UpperQueryNavPredMax = 8 [(NYT.column_name) = "UpperQueryNavPredMax"];
    optional double UpperDocNavPred0Avg = 9 [(NYT.column_name) = "UpperDocNavPred0Avg"];
    optional double UpperDocNavPred0Max = 10 [(NYT.column_name) = "UpperDocNavPred0Max"];
    optional double ClicksAvg = 11 [(NYT.column_name) = "ClicksAvg"];
    optional double ClicksMax = 12 [(NYT.column_name) = "ClicksMax"];
    optional double ShowsAvg = 13 [(NYT.column_name) = "ShowsAvg"];
    optional double ShowsMax = 14 [(NYT.column_name) = "ShowsMax"];
    optional double Cm2Avg = 15 [(NYT.column_name) = "Cm2Avg"];
    optional double Cm2Max = 16 [(NYT.column_name) = "Cm2Max"];
    optional double UpperPornoUpperPl = 17 [(NYT.column_name) = "UpperPornoUpperPl"];
}

message TNicheRivalReport {
    optional string Host                =  1 [(NYT.column_name) = "Host"];
    optional string Rival               =  2 [(NYT.column_name) = "Rival"];
    optional uint64 RegionId            =  4 [(NYT.column_name) = "RegionId"];
    optional bool IsMobile              =  5 [(NYT.column_name) = "IsMobile"];
    optional bool IsPad                 =  6 [(NYT.column_name) = "IsPad"];
    optional double Visibility          =  7 [(NYT.column_name) = "Visibility"];
    optional double Popularity          =  8 [(NYT.column_name) = "Popularity"];
    optional uint64 QuerySourceFlag     =  9 [(NYT.column_name) = "QuerySource"];
}