<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/audit/audit_log.proto

namespace Google\Cloud\Audit\ServiceAccountDelegationInfo;

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

/**
 * First party identity principal.
 *
 * Generated from protobuf message <code>google.cloud.audit.ServiceAccountDelegationInfo.FirstPartyPrincipal</code>
 */
class FirstPartyPrincipal extends \Google\Protobuf\Internal\Message
{
    /**
     * The email address of a Google account.
     *
     * Generated from protobuf field <code>string principal_email = 1;</code>
     */
    protected $principal_email = '';
    /**
     * Metadata about the service that uses the service account.
     *
     * Generated from protobuf field <code>.google.protobuf.Struct service_metadata = 2;</code>
     */
    protected $service_metadata = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $principal_email
     *           The email address of a Google account.
     *     @type \Google\Protobuf\Struct $service_metadata
     *           Metadata about the service that uses the service account.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Audit\AuditLog::initOnce();
        parent::__construct($data);
    }

    /**
     * The email address of a Google account.
     *
     * Generated from protobuf field <code>string principal_email = 1;</code>
     * @return string
     */
    public function getPrincipalEmail()
    {
        return $this->principal_email;
    }

    /**
     * The email address of a Google account.
     *
     * Generated from protobuf field <code>string principal_email = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setPrincipalEmail($var)
    {
        GPBUtil::checkString($var, True);
        $this->principal_email = $var;

        return $this;
    }

    /**
     * Metadata about the service that uses the service account.
     *
     * Generated from protobuf field <code>.google.protobuf.Struct service_metadata = 2;</code>
     * @return \Google\Protobuf\Struct|null
     */
    public function getServiceMetadata()
    {
        return isset($this->service_metadata) ? $this->service_metadata : null;
    }

    public function hasServiceMetadata()
    {
        return isset($this->service_metadata);
    }

    public function clearServiceMetadata()
    {
        unset($this->service_metadata);
    }

    /**
     * Metadata about the service that uses the service account.
     *
     * Generated from protobuf field <code>.google.protobuf.Struct service_metadata = 2;</code>
     * @param \Google\Protobuf\Struct $var
     * @return $this
     */
    public function setServiceMetadata($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class);
        $this->service_metadata = $var;

        return $this;
    }

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(FirstPartyPrincipal::class, \Google\Cloud\Audit\ServiceAccountDelegationInfo_FirstPartyPrincipal::class);

