package wmc.stubs;

//-------------------------------- enums
enum format_error_type
{
    ERR_RULE_NOT_SLASH          = 0;
    ERR_ASTERISK_MULTI          = 1;
    ERR_HOST_MULTI              = 2;
    ERR_ROBOTS_HUGE             = 3;
    ERR_RULE_BEFORE_USER_AGENT  = 4;
    ERR_RULE_HUGE               = 5;
    ERR_HOST_FORMAT             = 6;
    ERR_SITEMAP_FORMAT          = 7;
    ERR_CRAWL_DELAY_FORMAT      = 8;
    ERR_CRAWL_DELAY_MULTI       = 9;
    ERR_CLEAN_PARAM_FORMAT      = 10;
    WARN_SUSPECT_SYMBOL         = 11;
    WARN_UNKNOWN_FIELD          = 12;
    WARN_TRASH                  = 13;
    UNKNOWN_TYPE                = 14;
}

enum url_error_type
{
    ERR_URL_SYNTAX = 1;
}

enum error_code
{
    HostNotFound = 0;
    ProcessingError = 1;
    HostInProcess = 2;
    UrlNotFound = 3;
}

enum stm_type
{
    ST_UNKNOWN = 0;
    ST_TEXT = 1;
    ST_XML_SITEMAP = 2;
    ST_XML_SITEMAPINDEX = 3;
    ST_XML_RSS = 4;
    ST_MALFORMED_SITEMAP = 5;
}

enum stm_error_code
{
    WRN_UNKNOWN_TAG                 = 1;
    WRN_TAG_CANNOT_BE_EMPTY         = 2;
    WRN_TAG_CANNOT_BE_COMPLEX       = 3;
    WRN_TAG_DATA_TOO_LONG           = 4;
    WRN_TAG_EMPTY_DATA              = 5;
    WRN_PRIORITY_INVALID            = 6;
    WRN_LASTMOD_INVALID             = 7;
    WRN_TOO_MANY_WARNINGS           = 8;
    WRN_CHANGEFREQ_INVALID          = 9;

    ERR_URL_TOO_LONG                = 100; //ERR_ERRORS;
    ERR_URL_INVALID                 = 101;

    ERR_UNKNOWN_TAG                 = 102;
    ERR_TAG_CANNOT_BE_EMPTY         = 103;
    ERR_TAG_APPEARS_TWICE           = 104;
    ERR_TAG_CANNOT_BE_COMPLEX       = 105;
    ERR_TAG_DATA_TOO_LONG           = 106;
    ERR_TAG_EMPTY_DATA              = 107;
    ERR_INCOMPLETE_URL_DATA         = 108;

    ERR_HOST_NOT_CONFIRM            = 109;
    ERR_PREFIX_DONT_MATCH           = 110;
    ERR_UNEXPECTED_ENTITY           = 111;

    ERR_DUPLICATE_ALTERNATE_HREF    = 112; // duplicated alternate lang hrefs
    ERR_MISSING_ATTRIBUTE           = 113;
    ERR_DUPLICATE_ATTRIBUTE         = 114;
    ERR_INVALID_ATTRIBUTE_VALUE     = 115;
    ERR_UNKNOWN_ATTRIBUTE           = 116;
    ERR_MISSING_ELEMENT             = 117;
    ERR_INVALID_ELEMENT_VALUE       = 118;

    ERR_INVALID_TEXT_FORMAT         = 200; //ERR_FATAL;
    ERR_INVALID_XML                 = 201;
    ERR_INVALID_MAIN_TAG            = 202;
    ERR_TOO_MANY_URLS               = 203;
    ERR_ILLEGAL_BOM                 = 204;

    ERR_HTTP_DNS_FAILURE            = 1006; //HTTP_DNS_FAILURE;
    ERR_HTTP_FILTER_DISALLOW        = 1011; //HTTP_FILTER_DISALLOW;
    ERR_HTTP_CONNECT_FAILED         = 1010; //HTTP_CONNECT_FAILED;
    ERR_HTTP_SSL_ERROR              = 1037; //HTTP_SSL_ERROR;

    WRN_MEDIA_ALLOW_EMBED_INVALID   = 300; //WRN_MEDIA;
    WRN_MEDIA_DURATION_INVALID      = 301;
    WRN_MEDIA_EXPIRATION_INVALID    = 302;
    WRN_MEDIA_VIEWS_INVALID         = 303;
    WRN_MEDIA_UPLOAD_DATE_INVALID   = 304;
    WRN_MEDIA_ADULT_FLAG_INVALID    = 305;
}

//-------------------------------- structures
message error_info
{
    required format_error_type type = 1;
    required int64 line_num = 2;
}

message allow_info
{
    required bool allowed = 1;
    required string rule = 2;
    optional url_error_type type = 3;
    optional string changed_url = 4;
}

message stm_error_info
{
    required stm_error_code code = 1;
    required int64          line_num = 2;
    optional string         msg = 3;
    optional int64          column_num = 4;
}


//-------------------------------- messages
message error_msg
{
    required error_code val = 1;
    optional string desc = 2;
}

message host_info_msg
{
    required string name = 1;
    required string segment = 2;
    required uint64 hostId = 3;
    required uint64 urls = 4;
    required uint64 docs = 5;
    required uint32 status = 6;
    required int64 add_time = 7;
    required int64 last_access = 8;
}

message host_info_err_msg
{
    optional host_info_msg val = 1;
    optional error_msg err = 2;
}

message analysis_result_msg
{
    repeated error_info errors = 1;
    repeated int64 accepted_lines = 2;
    repeated allow_info are_allowed = 3;
}

message stm_result_msg
{
    repeated stm_error_info errors = 1;
    required int64 urls_count = 2;
    required stm_type sitemap_type = 3;
}

message long_msg
{
    required int64 val = 1;
}

message long_err_msg
{
    optional long_msg val = 1;
    optional error_msg err = 2;
}

message bool_msg
{
    required bool val = 1;
}

message string_msg
{
    required string val = 1;
}

message mirrors_for_host_msg
{
    required string main_mirror = 1;
    repeated string mirrors = 2;
}

message url_info_msg
{
    required string hostname = 1;
    required string url = 2;
    required int64 add_time = 3;
    required int64 http_mod_time = 4;
    required int64 last_access = 5;
    required uint32 size = 6;
    required bool is_new = 7;
    required bool is_lost = 8;
    required bool has_int_links = 9;
    required bool has_ext_links = 10;
    required bool is_filtered = 11;
    required uint32 http_code = 12;
    required int64 mod_time = 13;
}

message url_info_err_msg
{
    optional url_info_msg val = 1;
    optional error_msg err = 2;
}

message url_info_lite_msg
{
    required string hostname = 1;
    required string url = 2;
    required int32 last_access = 3;
    required uint32 http_code = 4;
    required uint32 status = 5;
}

message url_info_lite_err_msg
{
    optional url_info_lite_msg val = 1;
    optional error_msg err = 2;
}

message uint32_msg
{
    required uint32 val = 1;
}

message host_info_search_docs_count
{
    optional uint32_msg val = 1;
    optional error_msg err = 2;
}
