import "wmconsole/version3/protos/common.proto";

package NWebmaster.proto.urltree;
option java_package = "ru.yandex.webmaster3.proto";

enum YandexSearchShardId {
    RU              = 0;
    UA              = 1;
    COM             = 2;
    COM_TR          = 3;
    RU_ACCEPTANCE   = 4;
}

enum SearchSourceId {
    PRODUCTION  = 0;
    ACCEPTANCE  = 1;
}

message UrlTreeMessage {
    required ApplicationInfo application_info   = 1;
    required MessageInfo message_info           = 2;

    repeated HostInfo hosts                     = 10;
}

message HostInfo {
    required string hostname                        = 1;
    repeated NodeInfo nodes                         = 2;
    repeated NodeInfo user_nodes                    = 3;
    optional bool fake                              = 4;
    optional int64 searchdb_production_timestamp    = 5;
    optional int64 searchdb_acceptance_timestamp    = 6;
}

message NodeInfo {
    required string name                            = 1;
    optional int32 node_id                          = 2;
    optional int32 parent_id                        = 3;
    optional int64 num_of_docs                      = 4;
    optional int64 num_of_docs_on_search            = 5;
    repeated HttpCodeInfo httpcodes                 = 6;
    required YandexSearchShardId shard_id           = 7;
    repeated UrlSampleInfo docs_on_search_samples   = 8;
    optional int64 num_of_doubles                   = 9;
    optional int64 avg_fetch_time                   = 10;
    repeated HttpCodeInfo doubles_codes             = 11;
    optional int64 num_of_new_search_docs           = 12;
    optional int64 num_of_gone_search_docs          = 13;
    optional SearchSourceId search_source_id        = 14;
    repeated UrlStatusInfo url_statuses             = 15;
    optional int64 num_of_turbo_pages               = 16;
    repeated TurboSourceInfo turbo_source_info      = 17;
}

message TurboSourceInfo {
    required uint64 source_id         = 1;
    required uint64 total             = 2;
}

message UrlStatusInfo {
    required int32 url_status       = 1;
    required int64 total            = 2;
    repeated UrlSampleInfo samples  = 3;
}

message HttpCodeInfo {
    required int32 code             = 1;
    required int64 total            = 2;
    repeated UrlSampleInfo samples  = 3;
}

message UrlSampleInfo {
    required string url         = 1;
    optional int64 last_access  = 2; //seconds since epoch
    optional int64 mod_time     = 3; //seconds since epoch
}
