<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/privacy/dlp/v2/dlp.proto

namespace Google\Cloud\Dlp\V2;

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

/**
 * This is a data encryption key (DEK) (as opposed to
 * a key encryption key (KEK) stored by Cloud Key Management Service
 * (Cloud KMS).
 * When using Cloud KMS to wrap or unwrap a DEK, be sure to set an appropriate
 * IAM policy on the KEK to ensure an attacker cannot
 * unwrap the DEK.
 *
 * Generated from protobuf message <code>google.privacy.dlp.v2.CryptoKey</code>
 */
class CryptoKey extends \Google\Protobuf\Internal\Message
{
    protected $source;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Dlp\V2\TransientCryptoKey $transient
     *           Transient crypto key
     *     @type \Google\Cloud\Dlp\V2\UnwrappedCryptoKey $unwrapped
     *           Unwrapped crypto key
     *     @type \Google\Cloud\Dlp\V2\KmsWrappedCryptoKey $kms_wrapped
     *           Key wrapped using Cloud KMS
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Privacy\Dlp\V2\Dlp::initOnce();
        parent::__construct($data);
    }

    /**
     * Transient crypto key
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.TransientCryptoKey transient = 1;</code>
     * @return \Google\Cloud\Dlp\V2\TransientCryptoKey|null
     */
    public function getTransient()
    {
        return $this->readOneof(1);
    }

    public function hasTransient()
    {
        return $this->hasOneof(1);
    }

    /**
     * Transient crypto key
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.TransientCryptoKey transient = 1;</code>
     * @param \Google\Cloud\Dlp\V2\TransientCryptoKey $var
     * @return $this
     */
    public function setTransient($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\TransientCryptoKey::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * Unwrapped crypto key
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.UnwrappedCryptoKey unwrapped = 2;</code>
     * @return \Google\Cloud\Dlp\V2\UnwrappedCryptoKey|null
     */
    public function getUnwrapped()
    {
        return $this->readOneof(2);
    }

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

    /**
     * Unwrapped crypto key
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.UnwrappedCryptoKey unwrapped = 2;</code>
     * @param \Google\Cloud\Dlp\V2\UnwrappedCryptoKey $var
     * @return $this
     */
    public function setUnwrapped($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\UnwrappedCryptoKey::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Key wrapped using Cloud KMS
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.KmsWrappedCryptoKey kms_wrapped = 3;</code>
     * @return \Google\Cloud\Dlp\V2\KmsWrappedCryptoKey|null
     */
    public function getKmsWrapped()
    {
        return $this->readOneof(3);
    }

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

    /**
     * Key wrapped using Cloud KMS
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.KmsWrappedCryptoKey kms_wrapped = 3;</code>
     * @param \Google\Cloud\Dlp\V2\KmsWrappedCryptoKey $var
     * @return $this
     */
    public function setKmsWrapped($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\KmsWrappedCryptoKey::class);
        $this->writeOneof(3, $var);

        return $this;
    }

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

}

