<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/devtools/artifactregistry/v1/repository.proto

namespace Google\Cloud\ArtifactRegistry\V1;

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

/**
 * CleanupPolicyMostRecentVersions is an alternate condition of a CleanupPolicy
 * for retaining a minimum number of versions.
 *
 * Generated from protobuf message <code>google.devtools.artifactregistry.v1.CleanupPolicyMostRecentVersions</code>
 */
class CleanupPolicyMostRecentVersions extends \Google\Protobuf\Internal\Message
{
    /**
     * List of package name prefixes that will apply this rule.
     *
     * Generated from protobuf field <code>repeated string package_name_prefixes = 1;</code>
     */
    private $package_name_prefixes;
    /**
     * Minimum number of versions to keep.
     *
     * Generated from protobuf field <code>optional int32 keep_count = 2;</code>
     */
    protected $keep_count = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type array<string>|\Google\Protobuf\Internal\RepeatedField $package_name_prefixes
     *           List of package name prefixes that will apply this rule.
     *     @type int $keep_count
     *           Minimum number of versions to keep.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Devtools\Artifactregistry\V1\Repository::initOnce();
        parent::__construct($data);
    }

    /**
     * List of package name prefixes that will apply this rule.
     *
     * Generated from protobuf field <code>repeated string package_name_prefixes = 1;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getPackageNamePrefixes()
    {
        return $this->package_name_prefixes;
    }

    /**
     * List of package name prefixes that will apply this rule.
     *
     * Generated from protobuf field <code>repeated string package_name_prefixes = 1;</code>
     * @param array<string>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setPackageNamePrefixes($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->package_name_prefixes = $arr;

        return $this;
    }

    /**
     * Minimum number of versions to keep.
     *
     * Generated from protobuf field <code>optional int32 keep_count = 2;</code>
     * @return int
     */
    public function getKeepCount()
    {
        return isset($this->keep_count) ? $this->keep_count : 0;
    }

    public function hasKeepCount()
    {
        return isset($this->keep_count);
    }

    public function clearKeepCount()
    {
        unset($this->keep_count);
    }

    /**
     * Minimum number of versions to keep.
     *
     * Generated from protobuf field <code>optional int32 keep_count = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setKeepCount($var)
    {
        GPBUtil::checkInt32($var);
        $this->keep_count = $var;

        return $this;
    }

}

