/*
 * Copyright 2012 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Author: pulkitg@google.com (Pulkit Goyal)
//
// Blink critical line data proto.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package net_instaweb;

// Protobuf to encapsulate the information use by blink flow.
// Next id = 11
message BlinkCriticalLineData {
  // URL of the request.
  required string url = 1;

  // Critical HTML for the given URL. This can potentially be few KBs and could
  // blow out our cache in the presence of a large URL-space due to query-params
  // or large catalogs. Typed "bytes" not "string" as it can contain non-UTF-8
  // content.
  optional bytes critical_html = 2;

  // This is a JSON map from image URL to image content. Example -
  // { 'url1' : 'low res image data2', 'url2' : 'low_res_image_data2' }
  // Typed "bytes" not "string" as it can contain non-UTF-8 content.
  optional bytes critical_images_map = 3;

  // This is the part of the HTML which is not critical and will be sent to the
  // client after critical HTML and critical images. Typed "bytes" not "string"
  // as it can contain non-UTF-8 content.
  optional bytes non_critical_json = 4;

  // The value of the X-PSA-Last-Modified header.
  optional string last_modified_date = 5;

  // Hash of the content used for html change detection full-diff.
  optional string hash = 6;

  // Timestamp when the html diff was last done.
  optional int64 last_diff_timestamp_ms = 7 [ deprecated = true ];

  // Timestamp when critical line computation was last done.
  optional int64 last_critical_line_computation_timestamp_ms = 8;

  // Hash of the content used for html change detection smart-diff.
  optional string hash_smart_diff = 9;

  // Character-set determined for the URL.
  optional string charset = 10;
}

// Protobuf for tracking diff match info.
// Next id = 3
message DiffInfo {
  // A bit string that keeps the match/mis-match info for the last N requests.
  optional string diff_match_history = 1;

  // If set, indicates the time when mismatch threshold for blacklisting was
  // hit.
  optional int64 blacklist_timestamp_ms = 2;
}
