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

namespace Google\Cloud\Asset\V1\AnalyzerOrgPolicyConstraint;

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

/**
 * The definition of a constraint.
 *
 * Generated from protobuf message <code>google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.Constraint</code>
 */
class Constraint extends \Google\Protobuf\Internal\Message
{
    /**
     * The unique name of the constraint. Format of the name should be
     * * `constraints/{constraint_name}`
     * For example, `constraints/compute.disableSerialPortAccess`.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     */
    private $name = '';
    /**
     * The human readable name of the constraint.
     *
     * Generated from protobuf field <code>string display_name = 2;</code>
     */
    private $display_name = '';
    /**
     * Detailed description of what this `Constraint` controls as well as how
     * and where it is enforced.
     *
     * Generated from protobuf field <code>string description = 3;</code>
     */
    private $description = '';
    /**
     * The evaluation behavior of this constraint in the absence of 'Policy'.
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.Constraint.ConstraintDefault constraint_default = 4;</code>
     */
    private $constraint_default = 0;
    protected $constraint_type;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           The unique name of the constraint. Format of the name should be
     *           * `constraints/{constraint_name}`
     *           For example, `constraints/compute.disableSerialPortAccess`.
     *     @type string $display_name
     *           The human readable name of the constraint.
     *     @type string $description
     *           Detailed description of what this `Constraint` controls as well as how
     *           and where it is enforced.
     *     @type int $constraint_default
     *           The evaluation behavior of this constraint in the absence of 'Policy'.
     *     @type \Google\Cloud\Asset\V1\AnalyzerOrgPolicyConstraint\Constraint\ListConstraint $list_constraint
     *           Defines this constraint as being a ListConstraint.
     *     @type \Google\Cloud\Asset\V1\AnalyzerOrgPolicyConstraint\Constraint\BooleanConstraint $boolean_constraint
     *           Defines this constraint as being a BooleanConstraint.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Asset\V1\AssetService::initOnce();
        parent::__construct($data);
    }

    /**
     * The unique name of the constraint. Format of the name should be
     * * `constraints/{constraint_name}`
     * For example, `constraints/compute.disableSerialPortAccess`.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * The unique name of the constraint. Format of the name should be
     * * `constraints/{constraint_name}`
     * For example, `constraints/compute.disableSerialPortAccess`.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * The human readable name of the constraint.
     *
     * Generated from protobuf field <code>string display_name = 2;</code>
     * @return string
     */
    public function getDisplayName()
    {
        return $this->display_name;
    }

    /**
     * The human readable name of the constraint.
     *
     * Generated from protobuf field <code>string display_name = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setDisplayName($var)
    {
        GPBUtil::checkString($var, True);
        $this->display_name = $var;

        return $this;
    }

    /**
     * Detailed description of what this `Constraint` controls as well as how
     * and where it is enforced.
     *
     * Generated from protobuf field <code>string description = 3;</code>
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Detailed description of what this `Constraint` controls as well as how
     * and where it is enforced.
     *
     * Generated from protobuf field <code>string description = 3;</code>
     * @param string $var
     * @return $this
     */
    public function setDescription($var)
    {
        GPBUtil::checkString($var, True);
        $this->description = $var;

        return $this;
    }

    /**
     * The evaluation behavior of this constraint in the absence of 'Policy'.
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.Constraint.ConstraintDefault constraint_default = 4;</code>
     * @return int
     */
    public function getConstraintDefault()
    {
        return $this->constraint_default;
    }

    /**
     * The evaluation behavior of this constraint in the absence of 'Policy'.
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.Constraint.ConstraintDefault constraint_default = 4;</code>
     * @param int $var
     * @return $this
     */
    public function setConstraintDefault($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Asset\V1\AnalyzerOrgPolicyConstraint\Constraint\ConstraintDefault::class);
        $this->constraint_default = $var;

        return $this;
    }

    /**
     * Defines this constraint as being a ListConstraint.
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.Constraint.ListConstraint list_constraint = 5;</code>
     * @return \Google\Cloud\Asset\V1\AnalyzerOrgPolicyConstraint\Constraint\ListConstraint|null
     */
    public function getListConstraint()
    {
        return $this->readOneof(5);
    }

    public function hasListConstraint()
    {
        return $this->hasOneof(5);
    }

    /**
     * Defines this constraint as being a ListConstraint.
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.Constraint.ListConstraint list_constraint = 5;</code>
     * @param \Google\Cloud\Asset\V1\AnalyzerOrgPolicyConstraint\Constraint\ListConstraint $var
     * @return $this
     */
    public function setListConstraint($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\AnalyzerOrgPolicyConstraint\Constraint\ListConstraint::class);
        $this->writeOneof(5, $var);

        return $this;
    }

    /**
     * Defines this constraint as being a BooleanConstraint.
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.Constraint.BooleanConstraint boolean_constraint = 6;</code>
     * @return \Google\Cloud\Asset\V1\AnalyzerOrgPolicyConstraint\Constraint\BooleanConstraint|null
     */
    public function getBooleanConstraint()
    {
        return $this->readOneof(6);
    }

    public function hasBooleanConstraint()
    {
        return $this->hasOneof(6);
    }

    /**
     * Defines this constraint as being a BooleanConstraint.
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.Constraint.BooleanConstraint boolean_constraint = 6;</code>
     * @param \Google\Cloud\Asset\V1\AnalyzerOrgPolicyConstraint\Constraint\BooleanConstraint $var
     * @return $this
     */
    public function setBooleanConstraint($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\AnalyzerOrgPolicyConstraint\Constraint\BooleanConstraint::class);
        $this->writeOneof(6, $var);

        return $this;
    }

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

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Constraint::class, \Google\Cloud\Asset\V1\AnalyzerOrgPolicyConstraint_Constraint::class);

