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

namespace Google\Cloud\Dataplex\V1;

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

/**
 * A rule captures data quality intent about a data source.
 *
 * Generated from protobuf message <code>google.cloud.dataplex.v1.DataQualityRule</code>
 */
class DataQualityRule extends \Google\Protobuf\Internal\Message
{
    /**
     * Optional. The unnested column which this rule is evaluated against.
     *
     * Generated from protobuf field <code>string column = 500 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $column = '';
    /**
     * Optional. Rows with null values will automatically fail a rule, unless
     * ignore_null is true. In that case, such null rows are trivially considered
     * passing. Only applicable to ColumnMap rules.
     *
     * Generated from protobuf field <code>bool ignore_null = 501 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $ignore_null = false;
    /**
     * Required. The dimension a rule belongs to. Results are also aggregated at
     * the dimension-level. Supported dimensions are ["COMPLETENESS", "ACCURACY",
     * "CONSISTENCY", "VALIDITY", "UNIQUENESS", "INTEGRITY"]
     *
     * Generated from protobuf field <code>string dimension = 502 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $dimension = '';
    /**
     * Optional. The minimum ratio of passing_rows / total_rows required to pass
     * this rule, with a range of [0.0, 1.0]
     * 0 indicates default value (i.e. 1.0)
     *
     * Generated from protobuf field <code>double threshold = 503 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $threshold = 0.0;
    protected $rule_type;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Dataplex\V1\DataQualityRule\RangeExpectation $range_expectation
     *           ColumnMap rule which evaluates whether each column value lies between a
     *           specified range.
     *     @type \Google\Cloud\Dataplex\V1\DataQualityRule\NonNullExpectation $non_null_expectation
     *           ColumnMap rule which evaluates whether each column value is null.
     *     @type \Google\Cloud\Dataplex\V1\DataQualityRule\SetExpectation $set_expectation
     *           ColumnMap rule which evaluates whether each column value is contained by
     *           a specified set.
     *     @type \Google\Cloud\Dataplex\V1\DataQualityRule\RegexExpectation $regex_expectation
     *           ColumnMap rule which evaluates whether each column value matches a
     *           specified regex.
     *     @type \Google\Cloud\Dataplex\V1\DataQualityRule\UniquenessExpectation $uniqueness_expectation
     *           ColumnAggregate rule which evaluates whether the column has duplicates.
     *     @type \Google\Cloud\Dataplex\V1\DataQualityRule\StatisticRangeExpectation $statistic_range_expectation
     *           ColumnAggregate rule which evaluates whether the column aggregate
     *           statistic lies between a specified range.
     *     @type \Google\Cloud\Dataplex\V1\DataQualityRule\RowConditionExpectation $row_condition_expectation
     *           Table rule which evaluates whether each row passes the specified
     *           condition.
     *     @type \Google\Cloud\Dataplex\V1\DataQualityRule\TableConditionExpectation $table_condition_expectation
     *           Table rule which evaluates whether the provided expression is true.
     *     @type string $column
     *           Optional. The unnested column which this rule is evaluated against.
     *     @type bool $ignore_null
     *           Optional. Rows with null values will automatically fail a rule, unless
     *           ignore_null is true. In that case, such null rows are trivially considered
     *           passing. Only applicable to ColumnMap rules.
     *     @type string $dimension
     *           Required. The dimension a rule belongs to. Results are also aggregated at
     *           the dimension-level. Supported dimensions are ["COMPLETENESS", "ACCURACY",
     *           "CONSISTENCY", "VALIDITY", "UNIQUENESS", "INTEGRITY"]
     *     @type float $threshold
     *           Optional. The minimum ratio of passing_rows / total_rows required to pass
     *           this rule, with a range of [0.0, 1.0]
     *           0 indicates default value (i.e. 1.0)
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Dataplex\V1\DataQuality::initOnce();
        parent::__construct($data);
    }

    /**
     * ColumnMap rule which evaluates whether each column value lies between a
     * specified range.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule.RangeExpectation range_expectation = 1;</code>
     * @return \Google\Cloud\Dataplex\V1\DataQualityRule\RangeExpectation|null
     */
    public function getRangeExpectation()
    {
        return $this->readOneof(1);
    }

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

    /**
     * ColumnMap rule which evaluates whether each column value lies between a
     * specified range.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule.RangeExpectation range_expectation = 1;</code>
     * @param \Google\Cloud\Dataplex\V1\DataQualityRule\RangeExpectation $var
     * @return $this
     */
    public function setRangeExpectation($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dataplex\V1\DataQualityRule\RangeExpectation::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * ColumnMap rule which evaluates whether each column value is null.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule.NonNullExpectation non_null_expectation = 2;</code>
     * @return \Google\Cloud\Dataplex\V1\DataQualityRule\NonNullExpectation|null
     */
    public function getNonNullExpectation()
    {
        return $this->readOneof(2);
    }

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

    /**
     * ColumnMap rule which evaluates whether each column value is null.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule.NonNullExpectation non_null_expectation = 2;</code>
     * @param \Google\Cloud\Dataplex\V1\DataQualityRule\NonNullExpectation $var
     * @return $this
     */
    public function setNonNullExpectation($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dataplex\V1\DataQualityRule\NonNullExpectation::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * ColumnMap rule which evaluates whether each column value is contained by
     * a specified set.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule.SetExpectation set_expectation = 3;</code>
     * @return \Google\Cloud\Dataplex\V1\DataQualityRule\SetExpectation|null
     */
    public function getSetExpectation()
    {
        return $this->readOneof(3);
    }

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

    /**
     * ColumnMap rule which evaluates whether each column value is contained by
     * a specified set.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule.SetExpectation set_expectation = 3;</code>
     * @param \Google\Cloud\Dataplex\V1\DataQualityRule\SetExpectation $var
     * @return $this
     */
    public function setSetExpectation($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dataplex\V1\DataQualityRule\SetExpectation::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * ColumnMap rule which evaluates whether each column value matches a
     * specified regex.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule.RegexExpectation regex_expectation = 4;</code>
     * @return \Google\Cloud\Dataplex\V1\DataQualityRule\RegexExpectation|null
     */
    public function getRegexExpectation()
    {
        return $this->readOneof(4);
    }

    public function hasRegexExpectation()
    {
        return $this->hasOneof(4);
    }

    /**
     * ColumnMap rule which evaluates whether each column value matches a
     * specified regex.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule.RegexExpectation regex_expectation = 4;</code>
     * @param \Google\Cloud\Dataplex\V1\DataQualityRule\RegexExpectation $var
     * @return $this
     */
    public function setRegexExpectation($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dataplex\V1\DataQualityRule\RegexExpectation::class);
        $this->writeOneof(4, $var);

        return $this;
    }

    /**
     * ColumnAggregate rule which evaluates whether the column has duplicates.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule.UniquenessExpectation uniqueness_expectation = 100;</code>
     * @return \Google\Cloud\Dataplex\V1\DataQualityRule\UniquenessExpectation|null
     */
    public function getUniquenessExpectation()
    {
        return $this->readOneof(100);
    }

    public function hasUniquenessExpectation()
    {
        return $this->hasOneof(100);
    }

    /**
     * ColumnAggregate rule which evaluates whether the column has duplicates.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule.UniquenessExpectation uniqueness_expectation = 100;</code>
     * @param \Google\Cloud\Dataplex\V1\DataQualityRule\UniquenessExpectation $var
     * @return $this
     */
    public function setUniquenessExpectation($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dataplex\V1\DataQualityRule\UniquenessExpectation::class);
        $this->writeOneof(100, $var);

        return $this;
    }

    /**
     * ColumnAggregate rule which evaluates whether the column aggregate
     * statistic lies between a specified range.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule.StatisticRangeExpectation statistic_range_expectation = 101;</code>
     * @return \Google\Cloud\Dataplex\V1\DataQualityRule\StatisticRangeExpectation|null
     */
    public function getStatisticRangeExpectation()
    {
        return $this->readOneof(101);
    }

    public function hasStatisticRangeExpectation()
    {
        return $this->hasOneof(101);
    }

    /**
     * ColumnAggregate rule which evaluates whether the column aggregate
     * statistic lies between a specified range.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule.StatisticRangeExpectation statistic_range_expectation = 101;</code>
     * @param \Google\Cloud\Dataplex\V1\DataQualityRule\StatisticRangeExpectation $var
     * @return $this
     */
    public function setStatisticRangeExpectation($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dataplex\V1\DataQualityRule\StatisticRangeExpectation::class);
        $this->writeOneof(101, $var);

        return $this;
    }

    /**
     * Table rule which evaluates whether each row passes the specified
     * condition.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule.RowConditionExpectation row_condition_expectation = 200;</code>
     * @return \Google\Cloud\Dataplex\V1\DataQualityRule\RowConditionExpectation|null
     */
    public function getRowConditionExpectation()
    {
        return $this->readOneof(200);
    }

    public function hasRowConditionExpectation()
    {
        return $this->hasOneof(200);
    }

    /**
     * Table rule which evaluates whether each row passes the specified
     * condition.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule.RowConditionExpectation row_condition_expectation = 200;</code>
     * @param \Google\Cloud\Dataplex\V1\DataQualityRule\RowConditionExpectation $var
     * @return $this
     */
    public function setRowConditionExpectation($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dataplex\V1\DataQualityRule\RowConditionExpectation::class);
        $this->writeOneof(200, $var);

        return $this;
    }

    /**
     * Table rule which evaluates whether the provided expression is true.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule.TableConditionExpectation table_condition_expectation = 201;</code>
     * @return \Google\Cloud\Dataplex\V1\DataQualityRule\TableConditionExpectation|null
     */
    public function getTableConditionExpectation()
    {
        return $this->readOneof(201);
    }

    public function hasTableConditionExpectation()
    {
        return $this->hasOneof(201);
    }

    /**
     * Table rule which evaluates whether the provided expression is true.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule.TableConditionExpectation table_condition_expectation = 201;</code>
     * @param \Google\Cloud\Dataplex\V1\DataQualityRule\TableConditionExpectation $var
     * @return $this
     */
    public function setTableConditionExpectation($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dataplex\V1\DataQualityRule\TableConditionExpectation::class);
        $this->writeOneof(201, $var);

        return $this;
    }

    /**
     * Optional. The unnested column which this rule is evaluated against.
     *
     * Generated from protobuf field <code>string column = 500 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getColumn()
    {
        return $this->column;
    }

    /**
     * Optional. The unnested column which this rule is evaluated against.
     *
     * Generated from protobuf field <code>string column = 500 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setColumn($var)
    {
        GPBUtil::checkString($var, True);
        $this->column = $var;

        return $this;
    }

    /**
     * Optional. Rows with null values will automatically fail a rule, unless
     * ignore_null is true. In that case, such null rows are trivially considered
     * passing. Only applicable to ColumnMap rules.
     *
     * Generated from protobuf field <code>bool ignore_null = 501 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return bool
     */
    public function getIgnoreNull()
    {
        return $this->ignore_null;
    }

    /**
     * Optional. Rows with null values will automatically fail a rule, unless
     * ignore_null is true. In that case, such null rows are trivially considered
     * passing. Only applicable to ColumnMap rules.
     *
     * Generated from protobuf field <code>bool ignore_null = 501 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param bool $var
     * @return $this
     */
    public function setIgnoreNull($var)
    {
        GPBUtil::checkBool($var);
        $this->ignore_null = $var;

        return $this;
    }

    /**
     * Required. The dimension a rule belongs to. Results are also aggregated at
     * the dimension-level. Supported dimensions are ["COMPLETENESS", "ACCURACY",
     * "CONSISTENCY", "VALIDITY", "UNIQUENESS", "INTEGRITY"]
     *
     * Generated from protobuf field <code>string dimension = 502 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getDimension()
    {
        return $this->dimension;
    }

    /**
     * Required. The dimension a rule belongs to. Results are also aggregated at
     * the dimension-level. Supported dimensions are ["COMPLETENESS", "ACCURACY",
     * "CONSISTENCY", "VALIDITY", "UNIQUENESS", "INTEGRITY"]
     *
     * Generated from protobuf field <code>string dimension = 502 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setDimension($var)
    {
        GPBUtil::checkString($var, True);
        $this->dimension = $var;

        return $this;
    }

    /**
     * Optional. The minimum ratio of passing_rows / total_rows required to pass
     * this rule, with a range of [0.0, 1.0]
     * 0 indicates default value (i.e. 1.0)
     *
     * Generated from protobuf field <code>double threshold = 503 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return float
     */
    public function getThreshold()
    {
        return $this->threshold;
    }

    /**
     * Optional. The minimum ratio of passing_rows / total_rows required to pass
     * this rule, with a range of [0.0, 1.0]
     * 0 indicates default value (i.e. 1.0)
     *
     * Generated from protobuf field <code>double threshold = 503 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param float $var
     * @return $this
     */
    public function setThreshold($var)
    {
        GPBUtil::checkDouble($var);
        $this->threshold = $var;

        return $this;
    }

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

}

