<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/devtools/cloudbuild/v1/cloudbuild.proto

namespace Google\Cloud\Build\V1;

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

/**
 * WebhookConfig describes the configuration of a trigger that
 * creates a build whenever a webhook is sent to a trigger's webhook URL.
 *
 * Generated from protobuf message <code>google.devtools.cloudbuild.v1.WebhookConfig</code>
 */
class WebhookConfig extends \Google\Protobuf\Internal\Message
{
    /**
     * Potential issues with the underlying Pub/Sub subscription configuration.
     * Only populated on get requests.
     *
     * Generated from protobuf field <code>.google.devtools.cloudbuild.v1.WebhookConfig.State state = 4;</code>
     */
    private $state = 0;
    protected $auth_method;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $secret
     *           Required. Resource name for the secret required as a URL parameter.
     *     @type int $state
     *           Potential issues with the underlying Pub/Sub subscription configuration.
     *           Only populated on get requests.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Devtools\Cloudbuild\V1\Cloudbuild::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. Resource name for the secret required as a URL parameter.
     *
     * Generated from protobuf field <code>string secret = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getSecret()
    {
        return $this->readOneof(3);
    }

    public function hasSecret()
    {
        return $this->hasOneof(3);
    }

    /**
     * Required. Resource name for the secret required as a URL parameter.
     *
     * Generated from protobuf field <code>string secret = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setSecret($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * Potential issues with the underlying Pub/Sub subscription configuration.
     * Only populated on get requests.
     *
     * Generated from protobuf field <code>.google.devtools.cloudbuild.v1.WebhookConfig.State state = 4;</code>
     * @return int
     */
    public function getState()
    {
        return $this->state;
    }

    /**
     * Potential issues with the underlying Pub/Sub subscription configuration.
     * Only populated on get requests.
     *
     * Generated from protobuf field <code>.google.devtools.cloudbuild.v1.WebhookConfig.State state = 4;</code>
     * @param int $var
     * @return $this
     */
    public function setState($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Build\V1\WebhookConfig\State::class);
        $this->state = $var;

        return $this;
    }

    /**
     * @return string
     */
    public function getAuthMethod()
    {
        return $this->whichOneof("auth_method");
    }

}

