<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/analytics/admin/v1alpha/resources.proto

namespace Google\Analytics\Admin\V1alpha;

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

/**
 * A binding of a user to a set of roles.
 *
 * Generated from protobuf message <code>google.analytics.admin.v1alpha.AccessBinding</code>
 */
class AccessBinding extends \Google\Protobuf\Internal\Message
{
    /**
     * Output only. Resource name of this binding.
     * Format: accounts/{account}/accessBindings/{access_binding} or
     * properties/{property}/accessBindings/{access_binding}
     * Example:
     * "accounts/100/accessBindings/200"
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $name = '';
    /**
     * A list of roles for to grant to the parent resource.
     * Valid values:
     * predefinedRoles/viewer
     * predefinedRoles/analyst
     * predefinedRoles/editor
     * predefinedRoles/admin
     * predefinedRoles/no-cost-data
     * predefinedRoles/no-revenue-data
     * For users, if an empty list of roles is set, this AccessBinding will be
     * deleted.
     *
     * Generated from protobuf field <code>repeated string roles = 3;</code>
     */
    private $roles;
    protected $access_target;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $user
     *           If set, the email address of the user to set roles for.
     *           Format: "someuser&#64;gmail.com"
     *     @type string $name
     *           Output only. Resource name of this binding.
     *           Format: accounts/{account}/accessBindings/{access_binding} or
     *           properties/{property}/accessBindings/{access_binding}
     *           Example:
     *           "accounts/100/accessBindings/200"
     *     @type array<string>|\Google\Protobuf\Internal\RepeatedField $roles
     *           A list of roles for to grant to the parent resource.
     *           Valid values:
     *           predefinedRoles/viewer
     *           predefinedRoles/analyst
     *           predefinedRoles/editor
     *           predefinedRoles/admin
     *           predefinedRoles/no-cost-data
     *           predefinedRoles/no-revenue-data
     *           For users, if an empty list of roles is set, this AccessBinding will be
     *           deleted.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Analytics\Admin\V1Alpha\Resources::initOnce();
        parent::__construct($data);
    }

    /**
     * If set, the email address of the user to set roles for.
     * Format: "someuser&#64;gmail.com"
     *
     * Generated from protobuf field <code>string user = 2;</code>
     * @return string
     */
    public function getUser()
    {
        return $this->readOneof(2);
    }

    public function hasUser()
    {
        return $this->hasOneof(2);
    }

    /**
     * If set, the email address of the user to set roles for.
     * Format: "someuser&#64;gmail.com"
     *
     * Generated from protobuf field <code>string user = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setUser($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Output only. Resource name of this binding.
     * Format: accounts/{account}/accessBindings/{access_binding} or
     * properties/{property}/accessBindings/{access_binding}
     * Example:
     * "accounts/100/accessBindings/200"
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Output only. Resource name of this binding.
     * Format: accounts/{account}/accessBindings/{access_binding} or
     * properties/{property}/accessBindings/{access_binding}
     * Example:
     * "accounts/100/accessBindings/200"
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * A list of roles for to grant to the parent resource.
     * Valid values:
     * predefinedRoles/viewer
     * predefinedRoles/analyst
     * predefinedRoles/editor
     * predefinedRoles/admin
     * predefinedRoles/no-cost-data
     * predefinedRoles/no-revenue-data
     * For users, if an empty list of roles is set, this AccessBinding will be
     * deleted.
     *
     * Generated from protobuf field <code>repeated string roles = 3;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getRoles()
    {
        return $this->roles;
    }

    /**
     * A list of roles for to grant to the parent resource.
     * Valid values:
     * predefinedRoles/viewer
     * predefinedRoles/analyst
     * predefinedRoles/editor
     * predefinedRoles/admin
     * predefinedRoles/no-cost-data
     * predefinedRoles/no-revenue-data
     * For users, if an empty list of roles is set, this AccessBinding will be
     * deleted.
     *
     * Generated from protobuf field <code>repeated string roles = 3;</code>
     * @param array<string>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setRoles($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->roles = $arr;

        return $this;
    }

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

}

