// Copyright 2011 Google Inc. All Rights Reserved.
// Author: mmohabey@google.com (Megha Mohabey)
//
// Protocol Buffer definition for publisher config.
//
// Field Description
// Layout -                 Layout Details.
//  relative_url_patterns - Array of regular expression for identifying the urls
//                          that have the same layout.
//
// PublisherConfig
//  web_site -              The domain where publisher content is hosted.
//                          hosted.
//  Layout layout -         Array of the layouts for the publisher
//  url_ignore_params -     Array of url parameters ignored for canonicalization
//
// Example for publisher config for boutiques.com
// publisher_config {
//   web_site: "www.boutiques.com"
//   layout {
//     relative_url_patterns: "/lunr.py?type=.*"
//     relative_url_patterns: "/lunr.py?q=.*"
//     panel_set {
//       panels {
//         xpath: "//div[@id = \"container\"]"
//         end_marker_xpath: "//div[@id=\"nextcontainer\"]"
//         num_critical_instances: 2
//       }
//     }
//   }
// }


syntax = "proto2";

// [opensource] option optimize_for = LITE_RUNTIME;

package net_instaweb;

message PanelSet {
  repeated Panel panels = 1;
};

message Panel {
  // XPath identifying the start instance tag for the panel.
  // There may be multiple instances, each with its own start instance node.
  required string start_xpath = 1;
  // XPath identifying the marker beyond instances of this panel.
  // The marker can be text/comment/tag
  // The marker is not part of the panel.
  optional string end_marker_xpath = 2;

  optional int32 num_critical_instances = 3 [default = 0];
  optional int32 cacheability_in_minutes = 4 [default = 30];
};

message Layout {
  repeated string relative_url_patterns = 1;
  // Time in seconds for which any page of this layout is valid at root level
  required int32 page_max_age_s = 2;
  // Time in seconds for which this layout is valid
  required int32 layout_max_age_s = 3;
  required string reference_page_url_path = 4;
  optional PanelSet panel_set = 5;
}

message PublisherConfig {
  required string web_site = 1;
  repeated Layout layout = 2;
  // Represents a wildcard pattern for browser name/version blacklisting.
  repeated string browser_blacklist_patterns = 3;
}
