<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/apps/script/type/gmail/gmail_addon_manifest.proto

namespace Google\Apps\Script\Type\Gmail;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * Properties customizing the appearance and execution of a Gmail add-on.
 *
 * Generated from protobuf message <code>google.apps.script.type.gmail.GmailAddOnManifest</code>
 */
class GmailAddOnManifest extends \Google\Protobuf\Internal\Message
{
    /**
     * Defines an endpoint that will be executed in contexts that don't
     * match a declared contextual trigger. Any cards generated by this function
     * will always be available to the user, but may be eclipsed by contextual
     * content when this add-on declares more targeted triggers.
     * If present, this overrides the configuration from
     * `addOns.common.homepageTrigger`.
     *
     * Generated from protobuf field <code>.google.apps.script.type.HomepageExtensionPoint homepage_trigger = 14;</code>
     */
    protected $homepage_trigger = null;
    /**
     * Defines the set of conditions that trigger the add-on.
     *
     * Generated from protobuf field <code>repeated .google.apps.script.type.gmail.ContextualTrigger contextual_triggers = 3;</code>
     */
    private $contextual_triggers;
    /**
     * Defines set of [universal
     * actions](/gmail/add-ons/how-tos/universal-actions) for the add-on. The user
     * triggers universal actions from the add-on toolbar menu.
     *
     * Generated from protobuf field <code>repeated .google.apps.script.type.gmail.UniversalAction universal_actions = 4;</code>
     */
    private $universal_actions;
    /**
     * Defines the compose time trigger for a compose time add-on. This is the
     * trigger that causes an add-on to take action when the user is composing an
     * email.
     * All compose time addons are required to have the
     * gmail.addons.current.action.compose scope even though it might not edit the
     * draft.
     *
     * Generated from protobuf field <code>.google.apps.script.type.gmail.ComposeTrigger compose_trigger = 12;</code>
     */
    protected $compose_trigger = null;
    /**
     * The name of an endpoint that verifies that the add-on has
     * all the required third-party authorizations, by probing the third-party
     * APIs. If the probe fails, the function should throw an exception to
     * initiate the authorization flow. This function is called before each
     * invocation of the add-on, in order to ensure a smooth user experience.
     *
     * Generated from protobuf field <code>string authorization_check_function = 7;</code>
     */
    protected $authorization_check_function = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Apps\Script\Type\HomepageExtensionPoint $homepage_trigger
     *           Defines an endpoint that will be executed in contexts that don't
     *           match a declared contextual trigger. Any cards generated by this function
     *           will always be available to the user, but may be eclipsed by contextual
     *           content when this add-on declares more targeted triggers.
     *           If present, this overrides the configuration from
     *           `addOns.common.homepageTrigger`.
     *     @type array<\Google\Apps\Script\Type\Gmail\ContextualTrigger>|\Google\Protobuf\Internal\RepeatedField $contextual_triggers
     *           Defines the set of conditions that trigger the add-on.
     *     @type array<\Google\Apps\Script\Type\Gmail\UniversalAction>|\Google\Protobuf\Internal\RepeatedField $universal_actions
     *           Defines set of [universal
     *           actions](/gmail/add-ons/how-tos/universal-actions) for the add-on. The user
     *           triggers universal actions from the add-on toolbar menu.
     *     @type \Google\Apps\Script\Type\Gmail\ComposeTrigger $compose_trigger
     *           Defines the compose time trigger for a compose time add-on. This is the
     *           trigger that causes an add-on to take action when the user is composing an
     *           email.
     *           All compose time addons are required to have the
     *           gmail.addons.current.action.compose scope even though it might not edit the
     *           draft.
     *     @type string $authorization_check_function
     *           The name of an endpoint that verifies that the add-on has
     *           all the required third-party authorizations, by probing the third-party
     *           APIs. If the probe fails, the function should throw an exception to
     *           initiate the authorization flow. This function is called before each
     *           invocation of the add-on, in order to ensure a smooth user experience.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Apps\Script\Type\Gmail\GmailAddonManifest::initOnce();
        parent::__construct($data);
    }

    /**
     * Defines an endpoint that will be executed in contexts that don't
     * match a declared contextual trigger. Any cards generated by this function
     * will always be available to the user, but may be eclipsed by contextual
     * content when this add-on declares more targeted triggers.
     * If present, this overrides the configuration from
     * `addOns.common.homepageTrigger`.
     *
     * Generated from protobuf field <code>.google.apps.script.type.HomepageExtensionPoint homepage_trigger = 14;</code>
     * @return \Google\Apps\Script\Type\HomepageExtensionPoint|null
     */
    public function getHomepageTrigger()
    {
        return $this->homepage_trigger;
    }

    public function hasHomepageTrigger()
    {
        return isset($this->homepage_trigger);
    }

    public function clearHomepageTrigger()
    {
        unset($this->homepage_trigger);
    }

    /**
     * Defines an endpoint that will be executed in contexts that don't
     * match a declared contextual trigger. Any cards generated by this function
     * will always be available to the user, but may be eclipsed by contextual
     * content when this add-on declares more targeted triggers.
     * If present, this overrides the configuration from
     * `addOns.common.homepageTrigger`.
     *
     * Generated from protobuf field <code>.google.apps.script.type.HomepageExtensionPoint homepage_trigger = 14;</code>
     * @param \Google\Apps\Script\Type\HomepageExtensionPoint $var
     * @return $this
     */
    public function setHomepageTrigger($var)
    {
        GPBUtil::checkMessage($var, \Google\Apps\Script\Type\HomepageExtensionPoint::class);
        $this->homepage_trigger = $var;

        return $this;
    }

    /**
     * Defines the set of conditions that trigger the add-on.
     *
     * Generated from protobuf field <code>repeated .google.apps.script.type.gmail.ContextualTrigger contextual_triggers = 3;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getContextualTriggers()
    {
        return $this->contextual_triggers;
    }

    /**
     * Defines the set of conditions that trigger the add-on.
     *
     * Generated from protobuf field <code>repeated .google.apps.script.type.gmail.ContextualTrigger contextual_triggers = 3;</code>
     * @param array<\Google\Apps\Script\Type\Gmail\ContextualTrigger>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setContextualTriggers($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Script\Type\Gmail\ContextualTrigger::class);
        $this->contextual_triggers = $arr;

        return $this;
    }

    /**
     * Defines set of [universal
     * actions](/gmail/add-ons/how-tos/universal-actions) for the add-on. The user
     * triggers universal actions from the add-on toolbar menu.
     *
     * Generated from protobuf field <code>repeated .google.apps.script.type.gmail.UniversalAction universal_actions = 4;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getUniversalActions()
    {
        return $this->universal_actions;
    }

    /**
     * Defines set of [universal
     * actions](/gmail/add-ons/how-tos/universal-actions) for the add-on. The user
     * triggers universal actions from the add-on toolbar menu.
     *
     * Generated from protobuf field <code>repeated .google.apps.script.type.gmail.UniversalAction universal_actions = 4;</code>
     * @param array<\Google\Apps\Script\Type\Gmail\UniversalAction>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setUniversalActions($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Script\Type\Gmail\UniversalAction::class);
        $this->universal_actions = $arr;

        return $this;
    }

    /**
     * Defines the compose time trigger for a compose time add-on. This is the
     * trigger that causes an add-on to take action when the user is composing an
     * email.
     * All compose time addons are required to have the
     * gmail.addons.current.action.compose scope even though it might not edit the
     * draft.
     *
     * Generated from protobuf field <code>.google.apps.script.type.gmail.ComposeTrigger compose_trigger = 12;</code>
     * @return \Google\Apps\Script\Type\Gmail\ComposeTrigger|null
     */
    public function getComposeTrigger()
    {
        return $this->compose_trigger;
    }

    public function hasComposeTrigger()
    {
        return isset($this->compose_trigger);
    }

    public function clearComposeTrigger()
    {
        unset($this->compose_trigger);
    }

    /**
     * Defines the compose time trigger for a compose time add-on. This is the
     * trigger that causes an add-on to take action when the user is composing an
     * email.
     * All compose time addons are required to have the
     * gmail.addons.current.action.compose scope even though it might not edit the
     * draft.
     *
     * Generated from protobuf field <code>.google.apps.script.type.gmail.ComposeTrigger compose_trigger = 12;</code>
     * @param \Google\Apps\Script\Type\Gmail\ComposeTrigger $var
     * @return $this
     */
    public function setComposeTrigger($var)
    {
        GPBUtil::checkMessage($var, \Google\Apps\Script\Type\Gmail\ComposeTrigger::class);
        $this->compose_trigger = $var;

        return $this;
    }

    /**
     * The name of an endpoint that verifies that the add-on has
     * all the required third-party authorizations, by probing the third-party
     * APIs. If the probe fails, the function should throw an exception to
     * initiate the authorization flow. This function is called before each
     * invocation of the add-on, in order to ensure a smooth user experience.
     *
     * Generated from protobuf field <code>string authorization_check_function = 7;</code>
     * @return string
     */
    public function getAuthorizationCheckFunction()
    {
        return $this->authorization_check_function;
    }

    /**
     * The name of an endpoint that verifies that the add-on has
     * all the required third-party authorizations, by probing the third-party
     * APIs. If the probe fails, the function should throw an exception to
     * initiate the authorization flow. This function is called before each
     * invocation of the add-on, in order to ensure a smooth user experience.
     *
     * Generated from protobuf field <code>string authorization_check_function = 7;</code>
     * @param string $var
     * @return $this
     */
    public function setAuthorizationCheckFunction($var)
    {
        GPBUtil::checkString($var, True);
        $this->authorization_check_function = $var;

        return $this;
    }

}

