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

namespace Google\Cloud\BigQuery\Reservation\V1;

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

/**
 * Capacity commitment is a way to purchase compute capacity for BigQuery jobs
 * (in the form of slots) with some committed period of usage. Annual
 * commitments renew by default. Commitments can be removed after their
 * commitment end time passes.
 * In order to remove annual commitment, its plan needs to be changed
 * to monthly or flex first.
 * A capacity commitment resource exists as a child resource of the admin
 * project.
 *
 * Generated from protobuf message <code>google.cloud.bigquery.reservation.v1.CapacityCommitment</code>
 */
class CapacityCommitment extends \Google\Protobuf\Internal\Message
{
    /**
     * Output only. The resource name of the capacity commitment, e.g.,
     * `projects/myproject/locations/US/capacityCommitments/123`
     * The commitment_id must only contain lower case alphanumeric characters or
     * dashes. It must start with a letter and must not end
     * with a dash. Its maximum length is 64 characters.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $name = '';
    /**
     * Number of slots in this commitment.
     *
     * Generated from protobuf field <code>int64 slot_count = 2;</code>
     */
    private $slot_count = 0;
    /**
     * Capacity commitment commitment plan.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.reservation.v1.CapacityCommitment.CommitmentPlan plan = 3;</code>
     */
    private $plan = 0;
    /**
     * Output only. State of the commitment.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.reservation.v1.CapacityCommitment.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $state = 0;
    /**
     * Output only. The start of the current commitment period. It is applicable only for
     * ACTIVE capacity commitments.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp commitment_start_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $commitment_start_time = null;
    /**
     * Output only. The end of the current commitment period. It is applicable only for ACTIVE
     * capacity commitments.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp commitment_end_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $commitment_end_time = null;
    /**
     * Output only. For FAILED commitment plan, provides the reason of failure.
     *
     * Generated from protobuf field <code>.google.rpc.Status failure_status = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $failure_status = null;
    /**
     * The plan this capacity commitment is converted to after commitment_end_time
     * passes. Once the plan is changed, committed period is extended according to
     * commitment plan. Only applicable for ANNUAL and TRIAL commitments.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.reservation.v1.CapacityCommitment.CommitmentPlan renewal_plan = 8;</code>
     */
    private $renewal_plan = 0;
    /**
     * Applicable only for commitments located within one of the BigQuery
     * multi-regions (US or EU).
     * If set to true, this commitment is placed in the organization's
     * secondary region which is designated for disaster recovery purposes.
     * If false, this commitment is placed in the organization's default region.
     *
     * Generated from protobuf field <code>bool multi_region_auxiliary = 10;</code>
     */
    private $multi_region_auxiliary = false;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Output only. The resource name of the capacity commitment, e.g.,
     *           `projects/myproject/locations/US/capacityCommitments/123`
     *           The commitment_id must only contain lower case alphanumeric characters or
     *           dashes. It must start with a letter and must not end
     *           with a dash. Its maximum length is 64 characters.
     *     @type int|string $slot_count
     *           Number of slots in this commitment.
     *     @type int $plan
     *           Capacity commitment commitment plan.
     *     @type int $state
     *           Output only. State of the commitment.
     *     @type \Google\Protobuf\Timestamp $commitment_start_time
     *           Output only. The start of the current commitment period. It is applicable only for
     *           ACTIVE capacity commitments.
     *     @type \Google\Protobuf\Timestamp $commitment_end_time
     *           Output only. The end of the current commitment period. It is applicable only for ACTIVE
     *           capacity commitments.
     *     @type \Google\Rpc\Status $failure_status
     *           Output only. For FAILED commitment plan, provides the reason of failure.
     *     @type int $renewal_plan
     *           The plan this capacity commitment is converted to after commitment_end_time
     *           passes. Once the plan is changed, committed period is extended according to
     *           commitment plan. Only applicable for ANNUAL and TRIAL commitments.
     *     @type bool $multi_region_auxiliary
     *           Applicable only for commitments located within one of the BigQuery
     *           multi-regions (US or EU).
     *           If set to true, this commitment is placed in the organization's
     *           secondary region which is designated for disaster recovery purposes.
     *           If false, this commitment is placed in the organization's default region.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Bigquery\Reservation\V1\Reservation::initOnce();
        parent::__construct($data);
    }

    /**
     * Output only. The resource name of the capacity commitment, e.g.,
     * `projects/myproject/locations/US/capacityCommitments/123`
     * The commitment_id must only contain lower case alphanumeric characters or
     * dashes. It must start with a letter and must not end
     * with a dash. Its maximum length is 64 characters.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Output only. The resource name of the capacity commitment, e.g.,
     * `projects/myproject/locations/US/capacityCommitments/123`
     * The commitment_id must only contain lower case alphanumeric characters or
     * dashes. It must start with a letter and must not end
     * with a dash. Its maximum length is 64 characters.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Number of slots in this commitment.
     *
     * Generated from protobuf field <code>int64 slot_count = 2;</code>
     * @return int|string
     */
    public function getSlotCount()
    {
        return $this->slot_count;
    }

    /**
     * Number of slots in this commitment.
     *
     * Generated from protobuf field <code>int64 slot_count = 2;</code>
     * @param int|string $var
     * @return $this
     */
    public function setSlotCount($var)
    {
        GPBUtil::checkInt64($var);
        $this->slot_count = $var;

        return $this;
    }

    /**
     * Capacity commitment commitment plan.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.reservation.v1.CapacityCommitment.CommitmentPlan plan = 3;</code>
     * @return int
     */
    public function getPlan()
    {
        return $this->plan;
    }

    /**
     * Capacity commitment commitment plan.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.reservation.v1.CapacityCommitment.CommitmentPlan plan = 3;</code>
     * @param int $var
     * @return $this
     */
    public function setPlan($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\Reservation\V1\CapacityCommitment\CommitmentPlan::class);
        $this->plan = $var;

        return $this;
    }

    /**
     * Output only. State of the commitment.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.reservation.v1.CapacityCommitment.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return int
     */
    public function getState()
    {
        return $this->state;
    }

    /**
     * Output only. State of the commitment.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.reservation.v1.CapacityCommitment.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param int $var
     * @return $this
     */
    public function setState($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\Reservation\V1\CapacityCommitment\State::class);
        $this->state = $var;

        return $this;
    }

    /**
     * Output only. The start of the current commitment period. It is applicable only for
     * ACTIVE capacity commitments.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp commitment_start_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getCommitmentStartTime()
    {
        return $this->commitment_start_time;
    }

    public function hasCommitmentStartTime()
    {
        return isset($this->commitment_start_time);
    }

    public function clearCommitmentStartTime()
    {
        unset($this->commitment_start_time);
    }

    /**
     * Output only. The start of the current commitment period. It is applicable only for
     * ACTIVE capacity commitments.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp commitment_start_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setCommitmentStartTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->commitment_start_time = $var;

        return $this;
    }

    /**
     * Output only. The end of the current commitment period. It is applicable only for ACTIVE
     * capacity commitments.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp commitment_end_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getCommitmentEndTime()
    {
        return $this->commitment_end_time;
    }

    public function hasCommitmentEndTime()
    {
        return isset($this->commitment_end_time);
    }

    public function clearCommitmentEndTime()
    {
        unset($this->commitment_end_time);
    }

    /**
     * Output only. The end of the current commitment period. It is applicable only for ACTIVE
     * capacity commitments.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp commitment_end_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setCommitmentEndTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->commitment_end_time = $var;

        return $this;
    }

    /**
     * Output only. For FAILED commitment plan, provides the reason of failure.
     *
     * Generated from protobuf field <code>.google.rpc.Status failure_status = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Rpc\Status|null
     */
    public function getFailureStatus()
    {
        return $this->failure_status;
    }

    public function hasFailureStatus()
    {
        return isset($this->failure_status);
    }

    public function clearFailureStatus()
    {
        unset($this->failure_status);
    }

    /**
     * Output only. For FAILED commitment plan, provides the reason of failure.
     *
     * Generated from protobuf field <code>.google.rpc.Status failure_status = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Rpc\Status $var
     * @return $this
     */
    public function setFailureStatus($var)
    {
        GPBUtil::checkMessage($var, \Google\Rpc\Status::class);
        $this->failure_status = $var;

        return $this;
    }

    /**
     * The plan this capacity commitment is converted to after commitment_end_time
     * passes. Once the plan is changed, committed period is extended according to
     * commitment plan. Only applicable for ANNUAL and TRIAL commitments.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.reservation.v1.CapacityCommitment.CommitmentPlan renewal_plan = 8;</code>
     * @return int
     */
    public function getRenewalPlan()
    {
        return $this->renewal_plan;
    }

    /**
     * The plan this capacity commitment is converted to after commitment_end_time
     * passes. Once the plan is changed, committed period is extended according to
     * commitment plan. Only applicable for ANNUAL and TRIAL commitments.
     *
     * Generated from protobuf field <code>.google.cloud.bigquery.reservation.v1.CapacityCommitment.CommitmentPlan renewal_plan = 8;</code>
     * @param int $var
     * @return $this
     */
    public function setRenewalPlan($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\BigQuery\Reservation\V1\CapacityCommitment\CommitmentPlan::class);
        $this->renewal_plan = $var;

        return $this;
    }

    /**
     * Applicable only for commitments located within one of the BigQuery
     * multi-regions (US or EU).
     * If set to true, this commitment is placed in the organization's
     * secondary region which is designated for disaster recovery purposes.
     * If false, this commitment is placed in the organization's default region.
     *
     * Generated from protobuf field <code>bool multi_region_auxiliary = 10;</code>
     * @return bool
     */
    public function getMultiRegionAuxiliary()
    {
        return $this->multi_region_auxiliary;
    }

    /**
     * Applicable only for commitments located within one of the BigQuery
     * multi-regions (US or EU).
     * If set to true, this commitment is placed in the organization's
     * secondary region which is designated for disaster recovery purposes.
     * If false, this commitment is placed in the organization's default region.
     *
     * Generated from protobuf field <code>bool multi_region_auxiliary = 10;</code>
     * @param bool $var
     * @return $this
     */
    public function setMultiRegionAuxiliary($var)
    {
        GPBUtil::checkBool($var);
        $this->multi_region_auxiliary = $var;

        return $this;
    }

}

