<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/sql/v1beta4/cloud_sql_resources.proto

namespace Google\Cloud\Sql\V1beta4;

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

/**
 * A flag resource.
 *
 * Generated from protobuf message <code>google.cloud.sql.v1beta4.Flag</code>
 */
class Flag extends \Google\Protobuf\Internal\Message
{
    /**
     * This is the name of the flag. Flag names always use underscores, not
     * hyphens, for example: <b>max_allowed_packet</b>
     *
     * Generated from protobuf field <code>string name = 1;</code>
     */
    private $name = '';
    /**
     * The type of the flag. Flags are typed to being <b>BOOLEAN</b>,
     * <b>STRING</b>, <b>INTEGER</b> or <b>NONE</b>.
     * <b>NONE</b> is used for flags which do not take a value, such as
     * <b>skip_grant_tables</b>.
     *
     * Generated from protobuf field <code>.google.cloud.sql.v1beta4.SqlFlagType type = 2;</code>
     */
    private $type = 0;
    /**
     * The database version this flag applies to. Can be <b>MYSQL_8_0</b>,
     * <b>MYSQL_5_6</b>, or <b>MYSQL_5_7</b>.
     *
     * Generated from protobuf field <code>repeated .google.cloud.sql.v1beta4.SqlDatabaseVersion applies_to = 3;</code>
     */
    private $applies_to;
    /**
     * For <b>STRING</b> flags, a list of strings that the value can be set
     * to.
     *
     * Generated from protobuf field <code>repeated string allowed_string_values = 4;</code>
     */
    private $allowed_string_values;
    /**
     * For <b>INTEGER</b> flags, the minimum allowed value.
     *
     * Generated from protobuf field <code>.google.protobuf.Int64Value min_value = 5;</code>
     */
    private $min_value = null;
    /**
     * For <b>INTEGER</b> flags, the maximum allowed value.
     *
     * Generated from protobuf field <code>.google.protobuf.Int64Value max_value = 6;</code>
     */
    private $max_value = null;
    /**
     * Indicates whether changing this flag will trigger a database restart. Only
     * applicable to Second Generation instances.
     *
     * Generated from protobuf field <code>.google.protobuf.BoolValue requires_restart = 7;</code>
     */
    private $requires_restart = null;
    /**
     * This is always <b>sql#flag</b>.
     *
     * Generated from protobuf field <code>string kind = 8;</code>
     */
    private $kind = '';
    /**
     * Whether or not the flag is considered in beta.
     *
     * Generated from protobuf field <code>.google.protobuf.BoolValue in_beta = 9;</code>
     */
    private $in_beta = null;
    /**
     * Use this field if only certain integers are accepted. Can be combined
     * with min_value and max_value to add additional values.
     *
     * Generated from protobuf field <code>repeated int64 allowed_int_values = 10;</code>
     */
    private $allowed_int_values;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           This is the name of the flag. Flag names always use underscores, not
     *           hyphens, for example: <b>max_allowed_packet</b>
     *     @type int $type
     *           The type of the flag. Flags are typed to being <b>BOOLEAN</b>,
     *           <b>STRING</b>, <b>INTEGER</b> or <b>NONE</b>.
     *           <b>NONE</b> is used for flags which do not take a value, such as
     *           <b>skip_grant_tables</b>.
     *     @type int[]|\Google\Protobuf\Internal\RepeatedField $applies_to
     *           The database version this flag applies to. Can be <b>MYSQL_8_0</b>,
     *           <b>MYSQL_5_6</b>, or <b>MYSQL_5_7</b>.
     *     @type string[]|\Google\Protobuf\Internal\RepeatedField $allowed_string_values
     *           For <b>STRING</b> flags, a list of strings that the value can be set
     *           to.
     *     @type \Google\Protobuf\Int64Value $min_value
     *           For <b>INTEGER</b> flags, the minimum allowed value.
     *     @type \Google\Protobuf\Int64Value $max_value
     *           For <b>INTEGER</b> flags, the maximum allowed value.
     *     @type \Google\Protobuf\BoolValue $requires_restart
     *           Indicates whether changing this flag will trigger a database restart. Only
     *           applicable to Second Generation instances.
     *     @type string $kind
     *           This is always <b>sql#flag</b>.
     *     @type \Google\Protobuf\BoolValue $in_beta
     *           Whether or not the flag is considered in beta.
     *     @type int[]|string[]|\Google\Protobuf\Internal\RepeatedField $allowed_int_values
     *           Use this field if only certain integers are accepted. Can be combined
     *           with min_value and max_value to add additional values.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Sql\V1Beta4\CloudSqlResources::initOnce();
        parent::__construct($data);
    }

    /**
     * This is the name of the flag. Flag names always use underscores, not
     * hyphens, for example: <b>max_allowed_packet</b>
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * This is the name of the flag. Flag names always use underscores, not
     * hyphens, for example: <b>max_allowed_packet</b>
     *
     * 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 type of the flag. Flags are typed to being <b>BOOLEAN</b>,
     * <b>STRING</b>, <b>INTEGER</b> or <b>NONE</b>.
     * <b>NONE</b> is used for flags which do not take a value, such as
     * <b>skip_grant_tables</b>.
     *
     * Generated from protobuf field <code>.google.cloud.sql.v1beta4.SqlFlagType type = 2;</code>
     * @return int
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * The type of the flag. Flags are typed to being <b>BOOLEAN</b>,
     * <b>STRING</b>, <b>INTEGER</b> or <b>NONE</b>.
     * <b>NONE</b> is used for flags which do not take a value, such as
     * <b>skip_grant_tables</b>.
     *
     * Generated from protobuf field <code>.google.cloud.sql.v1beta4.SqlFlagType type = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setType($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Sql\V1beta4\SqlFlagType::class);
        $this->type = $var;

        return $this;
    }

    /**
     * The database version this flag applies to. Can be <b>MYSQL_8_0</b>,
     * <b>MYSQL_5_6</b>, or <b>MYSQL_5_7</b>.
     *
     * Generated from protobuf field <code>repeated .google.cloud.sql.v1beta4.SqlDatabaseVersion applies_to = 3;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getAppliesTo()
    {
        return $this->applies_to;
    }

    /**
     * The database version this flag applies to. Can be <b>MYSQL_8_0</b>,
     * <b>MYSQL_5_6</b>, or <b>MYSQL_5_7</b>.
     *
     * Generated from protobuf field <code>repeated .google.cloud.sql.v1beta4.SqlDatabaseVersion applies_to = 3;</code>
     * @param int[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setAppliesTo($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Sql\V1beta4\SqlDatabaseVersion::class);
        $this->applies_to = $arr;

        return $this;
    }

    /**
     * For <b>STRING</b> flags, a list of strings that the value can be set
     * to.
     *
     * Generated from protobuf field <code>repeated string allowed_string_values = 4;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getAllowedStringValues()
    {
        return $this->allowed_string_values;
    }

    /**
     * For <b>STRING</b> flags, a list of strings that the value can be set
     * to.
     *
     * Generated from protobuf field <code>repeated string allowed_string_values = 4;</code>
     * @param string[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setAllowedStringValues($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->allowed_string_values = $arr;

        return $this;
    }

    /**
     * For <b>INTEGER</b> flags, the minimum allowed value.
     *
     * Generated from protobuf field <code>.google.protobuf.Int64Value min_value = 5;</code>
     * @return \Google\Protobuf\Int64Value|null
     */
    public function getMinValue()
    {
        return isset($this->min_value) ? $this->min_value : null;
    }

    public function hasMinValue()
    {
        return isset($this->min_value);
    }

    public function clearMinValue()
    {
        unset($this->min_value);
    }

    /**
     * Returns the unboxed value from <code>getMinValue()</code>

     * For <b>INTEGER</b> flags, the minimum allowed value.
     *
     * Generated from protobuf field <code>.google.protobuf.Int64Value min_value = 5;</code>
     * @return int|string|null
     */
    public function getMinValueValue()
    {
        return $this->readWrapperValue("min_value");
    }

    /**
     * For <b>INTEGER</b> flags, the minimum allowed value.
     *
     * Generated from protobuf field <code>.google.protobuf.Int64Value min_value = 5;</code>
     * @param \Google\Protobuf\Int64Value $var
     * @return $this
     */
    public function setMinValue($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Int64Value::class);
        $this->min_value = $var;

        return $this;
    }

    /**
     * Sets the field by wrapping a primitive type in a Google\Protobuf\Int64Value object.

     * For <b>INTEGER</b> flags, the minimum allowed value.
     *
     * Generated from protobuf field <code>.google.protobuf.Int64Value min_value = 5;</code>
     * @param int|string|null $var
     * @return $this
     */
    public function setMinValueValue($var)
    {
        $this->writeWrapperValue("min_value", $var);
        return $this;}

    /**
     * For <b>INTEGER</b> flags, the maximum allowed value.
     *
     * Generated from protobuf field <code>.google.protobuf.Int64Value max_value = 6;</code>
     * @return \Google\Protobuf\Int64Value|null
     */
    public function getMaxValue()
    {
        return isset($this->max_value) ? $this->max_value : null;
    }

    public function hasMaxValue()
    {
        return isset($this->max_value);
    }

    public function clearMaxValue()
    {
        unset($this->max_value);
    }

    /**
     * Returns the unboxed value from <code>getMaxValue()</code>

     * For <b>INTEGER</b> flags, the maximum allowed value.
     *
     * Generated from protobuf field <code>.google.protobuf.Int64Value max_value = 6;</code>
     * @return int|string|null
     */
    public function getMaxValueValue()
    {
        return $this->readWrapperValue("max_value");
    }

    /**
     * For <b>INTEGER</b> flags, the maximum allowed value.
     *
     * Generated from protobuf field <code>.google.protobuf.Int64Value max_value = 6;</code>
     * @param \Google\Protobuf\Int64Value $var
     * @return $this
     */
    public function setMaxValue($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Int64Value::class);
        $this->max_value = $var;

        return $this;
    }

    /**
     * Sets the field by wrapping a primitive type in a Google\Protobuf\Int64Value object.

     * For <b>INTEGER</b> flags, the maximum allowed value.
     *
     * Generated from protobuf field <code>.google.protobuf.Int64Value max_value = 6;</code>
     * @param int|string|null $var
     * @return $this
     */
    public function setMaxValueValue($var)
    {
        $this->writeWrapperValue("max_value", $var);
        return $this;}

    /**
     * Indicates whether changing this flag will trigger a database restart. Only
     * applicable to Second Generation instances.
     *
     * Generated from protobuf field <code>.google.protobuf.BoolValue requires_restart = 7;</code>
     * @return \Google\Protobuf\BoolValue|null
     */
    public function getRequiresRestart()
    {
        return isset($this->requires_restart) ? $this->requires_restart : null;
    }

    public function hasRequiresRestart()
    {
        return isset($this->requires_restart);
    }

    public function clearRequiresRestart()
    {
        unset($this->requires_restart);
    }

    /**
     * Returns the unboxed value from <code>getRequiresRestart()</code>

     * Indicates whether changing this flag will trigger a database restart. Only
     * applicable to Second Generation instances.
     *
     * Generated from protobuf field <code>.google.protobuf.BoolValue requires_restart = 7;</code>
     * @return bool|null
     */
    public function getRequiresRestartValue()
    {
        return $this->readWrapperValue("requires_restart");
    }

    /**
     * Indicates whether changing this flag will trigger a database restart. Only
     * applicable to Second Generation instances.
     *
     * Generated from protobuf field <code>.google.protobuf.BoolValue requires_restart = 7;</code>
     * @param \Google\Protobuf\BoolValue $var
     * @return $this
     */
    public function setRequiresRestart($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\BoolValue::class);
        $this->requires_restart = $var;

        return $this;
    }

    /**
     * Sets the field by wrapping a primitive type in a Google\Protobuf\BoolValue object.

     * Indicates whether changing this flag will trigger a database restart. Only
     * applicable to Second Generation instances.
     *
     * Generated from protobuf field <code>.google.protobuf.BoolValue requires_restart = 7;</code>
     * @param bool|null $var
     * @return $this
     */
    public function setRequiresRestartValue($var)
    {
        $this->writeWrapperValue("requires_restart", $var);
        return $this;}

    /**
     * This is always <b>sql#flag</b>.
     *
     * Generated from protobuf field <code>string kind = 8;</code>
     * @return string
     */
    public function getKind()
    {
        return $this->kind;
    }

    /**
     * This is always <b>sql#flag</b>.
     *
     * Generated from protobuf field <code>string kind = 8;</code>
     * @param string $var
     * @return $this
     */
    public function setKind($var)
    {
        GPBUtil::checkString($var, True);
        $this->kind = $var;

        return $this;
    }

    /**
     * Whether or not the flag is considered in beta.
     *
     * Generated from protobuf field <code>.google.protobuf.BoolValue in_beta = 9;</code>
     * @return \Google\Protobuf\BoolValue|null
     */
    public function getInBeta()
    {
        return isset($this->in_beta) ? $this->in_beta : null;
    }

    public function hasInBeta()
    {
        return isset($this->in_beta);
    }

    public function clearInBeta()
    {
        unset($this->in_beta);
    }

    /**
     * Returns the unboxed value from <code>getInBeta()</code>

     * Whether or not the flag is considered in beta.
     *
     * Generated from protobuf field <code>.google.protobuf.BoolValue in_beta = 9;</code>
     * @return bool|null
     */
    public function getInBetaValue()
    {
        return $this->readWrapperValue("in_beta");
    }

    /**
     * Whether or not the flag is considered in beta.
     *
     * Generated from protobuf field <code>.google.protobuf.BoolValue in_beta = 9;</code>
     * @param \Google\Protobuf\BoolValue $var
     * @return $this
     */
    public function setInBeta($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\BoolValue::class);
        $this->in_beta = $var;

        return $this;
    }

    /**
     * Sets the field by wrapping a primitive type in a Google\Protobuf\BoolValue object.

     * Whether or not the flag is considered in beta.
     *
     * Generated from protobuf field <code>.google.protobuf.BoolValue in_beta = 9;</code>
     * @param bool|null $var
     * @return $this
     */
    public function setInBetaValue($var)
    {
        $this->writeWrapperValue("in_beta", $var);
        return $this;}

    /**
     * Use this field if only certain integers are accepted. Can be combined
     * with min_value and max_value to add additional values.
     *
     * Generated from protobuf field <code>repeated int64 allowed_int_values = 10;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getAllowedIntValues()
    {
        return $this->allowed_int_values;
    }

    /**
     * Use this field if only certain integers are accepted. Can be combined
     * with min_value and max_value to add additional values.
     *
     * Generated from protobuf field <code>repeated int64 allowed_int_values = 10;</code>
     * @param int[]|string[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setAllowedIntValues($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT64);
        $this->allowed_int_values = $arr;

        return $this;
    }

}

