// Copyright 2020 Google LLC
//
// 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.

syntax = "proto3";

package google.apps.script.type.docs;

import "google/api/field_behavior.proto";
import "google/apps/script/type/extension_point.proto";

option csharp_namespace = "Google.Apps.Script.Type.Docs";
option go_package = "google.golang.org/genproto/googleapis/apps/script/type/docs";
option java_multiple_files = true;
option java_outer_classname = "DocsAddOnManifestProto";
option java_package = "com.google.apps.script.type.docs";
option php_namespace = "Google\\Apps\\Script\\Type\\Docs";
option ruby_package = "Google::Apps::Script::Type::Docs";

// Manifest section specific to Docs Add-ons.

// Docs add-on manifest.
message DocsAddOnManifest {
  // If present, this overrides the configuration from
  // `addOns.common.homepageTrigger`.
  google.apps.script.type.HomepageExtensionPoint homepage_trigger = 1;

  // Endpoint to execute when file scope authorization is granted
  // for this document/user pair.
  DocsExtensionPoint on_file_scope_granted_trigger = 2;
}

// Common format for declaring a Docs add-on's triggers.
message DocsExtensionPoint {
  // Required. The endpoint to execute when this extension point is activated.
  string run_function = 1 [(google.api.field_behavior) = REQUIRED];
}
