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

namespace Google\Cloud\Sql\V1;

use UnexpectedValueException;

/**
 * Type of backup (i.e. automated, on demand, etc).
 *
 * Protobuf type <code>google.cloud.sql.v1.SqlBackupRunType</code>
 */
class SqlBackupRunType
{
    /**
     * This is an unknown BackupRun type.
     *
     * Generated from protobuf enum <code>SQL_BACKUP_RUN_TYPE_UNSPECIFIED = 0;</code>
     */
    const SQL_BACKUP_RUN_TYPE_UNSPECIFIED = 0;
    /**
     * The backup schedule automatically triggers a backup.
     *
     * Generated from protobuf enum <code>AUTOMATED = 1;</code>
     */
    const AUTOMATED = 1;
    /**
     * The user manually triggers a backup.
     *
     * Generated from protobuf enum <code>ON_DEMAND = 2;</code>
     */
    const ON_DEMAND = 2;

    private static $valueToName = [
        self::SQL_BACKUP_RUN_TYPE_UNSPECIFIED => 'SQL_BACKUP_RUN_TYPE_UNSPECIFIED',
        self::AUTOMATED => 'AUTOMATED',
        self::ON_DEMAND => 'ON_DEMAND',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }


    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}

