<?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;

/**
 * DataQualityRuleResult provides a more detailed, per-rule level view of the
 * results.
 *
 * Generated from protobuf message <code>google.cloud.dataplex.v1.DataQualityRuleResult</code>
 */
class DataQualityRuleResult extends \Google\Protobuf\Internal\Message
{
    /**
     * The rule specified in the DataQualitySpec, as is.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule rule = 1;</code>
     */
    private $rule = null;
    /**
     * Whether the rule passed or failed.
     *
     * Generated from protobuf field <code>bool passed = 7;</code>
     */
    private $passed = false;
    /**
     * The number of rows a rule was evaluated against.
     * This field is only valid for ColumnMap type rules.
     * Evaluated count can be configured to either
     * (1) include all rows (default) - with null rows automatically failing rule
     * evaluation  OR (2) exclude null rows from the evaluated_count, by setting
     * ignore_nulls = true
     *
     * Generated from protobuf field <code>int64 evaluated_count = 9;</code>
     */
    private $evaluated_count = 0;
    /**
     * The number of rows which passed a rule evaluation.
     * This field is only valid for ColumnMap type rules.
     *
     * Generated from protobuf field <code>int64 passed_count = 8;</code>
     */
    private $passed_count = 0;
    /**
     * The number of rows with null values in the specified column.
     *
     * Generated from protobuf field <code>int64 null_count = 5;</code>
     */
    private $null_count = 0;
    /**
     * The ratio of passed_count / evaluated_count.
     * This field is only valid for ColumnMap type rules.
     *
     * Generated from protobuf field <code>double pass_ratio = 6;</code>
     */
    private $pass_ratio = 0.0;
    /**
     * The query to find rows that did not pass this rule.
     * Only applies to ColumnMap and RowCondition rules.
     *
     * Generated from protobuf field <code>string failing_rows_query = 10;</code>
     */
    private $failing_rows_query = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Dataplex\V1\DataQualityRule $rule
     *           The rule specified in the DataQualitySpec, as is.
     *     @type bool $passed
     *           Whether the rule passed or failed.
     *     @type int|string $evaluated_count
     *           The number of rows a rule was evaluated against.
     *           This field is only valid for ColumnMap type rules.
     *           Evaluated count can be configured to either
     *           (1) include all rows (default) - with null rows automatically failing rule
     *           evaluation  OR (2) exclude null rows from the evaluated_count, by setting
     *           ignore_nulls = true
     *     @type int|string $passed_count
     *           The number of rows which passed a rule evaluation.
     *           This field is only valid for ColumnMap type rules.
     *     @type int|string $null_count
     *           The number of rows with null values in the specified column.
     *     @type float $pass_ratio
     *           The ratio of passed_count / evaluated_count.
     *           This field is only valid for ColumnMap type rules.
     *     @type string $failing_rows_query
     *           The query to find rows that did not pass this rule.
     *           Only applies to ColumnMap and RowCondition rules.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Dataplex\V1\DataQuality::initOnce();
        parent::__construct($data);
    }

    /**
     * The rule specified in the DataQualitySpec, as is.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule rule = 1;</code>
     * @return \Google\Cloud\Dataplex\V1\DataQualityRule|null
     */
    public function getRule()
    {
        return $this->rule;
    }

    public function hasRule()
    {
        return isset($this->rule);
    }

    public function clearRule()
    {
        unset($this->rule);
    }

    /**
     * The rule specified in the DataQualitySpec, as is.
     *
     * Generated from protobuf field <code>.google.cloud.dataplex.v1.DataQualityRule rule = 1;</code>
     * @param \Google\Cloud\Dataplex\V1\DataQualityRule $var
     * @return $this
     */
    public function setRule($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dataplex\V1\DataQualityRule::class);
        $this->rule = $var;

        return $this;
    }

    /**
     * Whether the rule passed or failed.
     *
     * Generated from protobuf field <code>bool passed = 7;</code>
     * @return bool
     */
    public function getPassed()
    {
        return $this->passed;
    }

    /**
     * Whether the rule passed or failed.
     *
     * Generated from protobuf field <code>bool passed = 7;</code>
     * @param bool $var
     * @return $this
     */
    public function setPassed($var)
    {
        GPBUtil::checkBool($var);
        $this->passed = $var;

        return $this;
    }

    /**
     * The number of rows a rule was evaluated against.
     * This field is only valid for ColumnMap type rules.
     * Evaluated count can be configured to either
     * (1) include all rows (default) - with null rows automatically failing rule
     * evaluation  OR (2) exclude null rows from the evaluated_count, by setting
     * ignore_nulls = true
     *
     * Generated from protobuf field <code>int64 evaluated_count = 9;</code>
     * @return int|string
     */
    public function getEvaluatedCount()
    {
        return $this->evaluated_count;
    }

    /**
     * The number of rows a rule was evaluated against.
     * This field is only valid for ColumnMap type rules.
     * Evaluated count can be configured to either
     * (1) include all rows (default) - with null rows automatically failing rule
     * evaluation  OR (2) exclude null rows from the evaluated_count, by setting
     * ignore_nulls = true
     *
     * Generated from protobuf field <code>int64 evaluated_count = 9;</code>
     * @param int|string $var
     * @return $this
     */
    public function setEvaluatedCount($var)
    {
        GPBUtil::checkInt64($var);
        $this->evaluated_count = $var;

        return $this;
    }

    /**
     * The number of rows which passed a rule evaluation.
     * This field is only valid for ColumnMap type rules.
     *
     * Generated from protobuf field <code>int64 passed_count = 8;</code>
     * @return int|string
     */
    public function getPassedCount()
    {
        return $this->passed_count;
    }

    /**
     * The number of rows which passed a rule evaluation.
     * This field is only valid for ColumnMap type rules.
     *
     * Generated from protobuf field <code>int64 passed_count = 8;</code>
     * @param int|string $var
     * @return $this
     */
    public function setPassedCount($var)
    {
        GPBUtil::checkInt64($var);
        $this->passed_count = $var;

        return $this;
    }

    /**
     * The number of rows with null values in the specified column.
     *
     * Generated from protobuf field <code>int64 null_count = 5;</code>
     * @return int|string
     */
    public function getNullCount()
    {
        return $this->null_count;
    }

    /**
     * The number of rows with null values in the specified column.
     *
     * Generated from protobuf field <code>int64 null_count = 5;</code>
     * @param int|string $var
     * @return $this
     */
    public function setNullCount($var)
    {
        GPBUtil::checkInt64($var);
        $this->null_count = $var;

        return $this;
    }

    /**
     * The ratio of passed_count / evaluated_count.
     * This field is only valid for ColumnMap type rules.
     *
     * Generated from protobuf field <code>double pass_ratio = 6;</code>
     * @return float
     */
    public function getPassRatio()
    {
        return $this->pass_ratio;
    }

    /**
     * The ratio of passed_count / evaluated_count.
     * This field is only valid for ColumnMap type rules.
     *
     * Generated from protobuf field <code>double pass_ratio = 6;</code>
     * @param float $var
     * @return $this
     */
    public function setPassRatio($var)
    {
        GPBUtil::checkDouble($var);
        $this->pass_ratio = $var;

        return $this;
    }

    /**
     * The query to find rows that did not pass this rule.
     * Only applies to ColumnMap and RowCondition rules.
     *
     * Generated from protobuf field <code>string failing_rows_query = 10;</code>
     * @return string
     */
    public function getFailingRowsQuery()
    {
        return $this->failing_rows_query;
    }

    /**
     * The query to find rows that did not pass this rule.
     * Only applies to ColumnMap and RowCondition rules.
     *
     * Generated from protobuf field <code>string failing_rows_query = 10;</code>
     * @param string $var
     * @return $this
     */
    public function setFailingRowsQuery($var)
    {
        GPBUtil::checkString($var, True);
        $this->failing_rows_query = $var;

        return $this;
    }

}

