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

namespace Google\Privacy\Dlp\V2beta1;

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

/**
 * The transformation to apply to the field.
 *
 * Generated from protobuf message <code>google.privacy.dlp.v2beta1.FieldTransformation</code>
 */
class FieldTransformation extends \Google\Protobuf\Internal\Message
{
    /**
     * Input field(s) to apply the transformation to. [required]
     *
     * Generated from protobuf field <code>repeated .google.privacy.dlp.v2beta1.FieldId fields = 1;</code>
     */
    private $fields;
    /**
     * Only apply the transformation if the condition evaluates to true for the
     * given `RecordCondition`. The conditions are allowed to reference fields
     * that are not used in the actual transformation. [optional]
     * Example Use Cases:
     * - Apply a different bucket transformation to an age column if the zip code
     * column for the same record is within a specific range.
     * - Redact a field if the date of birth field is greater than 85.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2beta1.RecordCondition condition = 3;</code>
     */
    private $condition = null;
    protected $transformation;

    public function __construct() {
        \GPBMetadata\Google\Privacy\Dlp\V2Beta1\Dlp::initOnce();
        parent::__construct();
    }

    /**
     * Input field(s) to apply the transformation to. [required]
     *
     * Generated from protobuf field <code>repeated .google.privacy.dlp.v2beta1.FieldId fields = 1;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getFields()
    {
        return $this->fields;
    }

    /**
     * Input field(s) to apply the transformation to. [required]
     *
     * Generated from protobuf field <code>repeated .google.privacy.dlp.v2beta1.FieldId fields = 1;</code>
     * @param \Google\Privacy\Dlp\V2beta1\FieldId[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setFields($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Privacy\Dlp\V2beta1\FieldId::class);
        $this->fields = $arr;

        return $this;
    }

    /**
     * Only apply the transformation if the condition evaluates to true for the
     * given `RecordCondition`. The conditions are allowed to reference fields
     * that are not used in the actual transformation. [optional]
     * Example Use Cases:
     * - Apply a different bucket transformation to an age column if the zip code
     * column for the same record is within a specific range.
     * - Redact a field if the date of birth field is greater than 85.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2beta1.RecordCondition condition = 3;</code>
     * @return \Google\Privacy\Dlp\V2beta1\RecordCondition
     */
    public function getCondition()
    {
        return $this->condition;
    }

    /**
     * Only apply the transformation if the condition evaluates to true for the
     * given `RecordCondition`. The conditions are allowed to reference fields
     * that are not used in the actual transformation. [optional]
     * Example Use Cases:
     * - Apply a different bucket transformation to an age column if the zip code
     * column for the same record is within a specific range.
     * - Redact a field if the date of birth field is greater than 85.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2beta1.RecordCondition condition = 3;</code>
     * @param \Google\Privacy\Dlp\V2beta1\RecordCondition $var
     * @return $this
     */
    public function setCondition($var)
    {
        GPBUtil::checkMessage($var, \Google\Privacy\Dlp\V2beta1\RecordCondition::class);
        $this->condition = $var;

        return $this;
    }

    /**
     * Apply the transformation to the entire field.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2beta1.PrimitiveTransformation primitive_transformation = 4;</code>
     * @return \Google\Privacy\Dlp\V2beta1\PrimitiveTransformation
     */
    public function getPrimitiveTransformation()
    {
        return $this->readOneof(4);
    }

    /**
     * Apply the transformation to the entire field.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2beta1.PrimitiveTransformation primitive_transformation = 4;</code>
     * @param \Google\Privacy\Dlp\V2beta1\PrimitiveTransformation $var
     * @return $this
     */
    public function setPrimitiveTransformation($var)
    {
        GPBUtil::checkMessage($var, \Google\Privacy\Dlp\V2beta1\PrimitiveTransformation::class);
        $this->writeOneof(4, $var);

        return $this;
    }

    /**
     * Treat the contents of the field as free text, and selectively
     * transform content that matches an `InfoType`.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2beta1.InfoTypeTransformations info_type_transformations = 5;</code>
     * @return \Google\Privacy\Dlp\V2beta1\InfoTypeTransformations
     */
    public function getInfoTypeTransformations()
    {
        return $this->readOneof(5);
    }

    /**
     * Treat the contents of the field as free text, and selectively
     * transform content that matches an `InfoType`.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2beta1.InfoTypeTransformations info_type_transformations = 5;</code>
     * @param \Google\Privacy\Dlp\V2beta1\InfoTypeTransformations $var
     * @return $this
     */
    public function setInfoTypeTransformations($var)
    {
        GPBUtil::checkMessage($var, \Google\Privacy\Dlp\V2beta1\InfoTypeTransformations::class);
        $this->writeOneof(5, $var);

        return $this;
    }

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

}

