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

namespace Google\Cloud\ArtifactRegistry\V1beta2;

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

/**
 * Files store content that is potentially associated with Packages or Versions.
 *
 * Generated from protobuf message <code>google.devtools.artifactregistry.v1beta2.File</code>
 */
class File extends \Google\Protobuf\Internal\Message
{
    /**
     * The name of the file, for example:
     * "projects/p1/locations/us-central1/repositories/repo1/files/a%2Fb%2Fc.txt".
     * If the file ID part contains slashes, they are escaped.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     */
    private $name = '';
    /**
     * The size of the File in bytes.
     *
     * Generated from protobuf field <code>int64 size_bytes = 3;</code>
     */
    private $size_bytes = 0;
    /**
     * The hashes of the file content.
     *
     * Generated from protobuf field <code>repeated .google.devtools.artifactregistry.v1beta2.Hash hashes = 4;</code>
     */
    private $hashes;
    /**
     * The time when the File was created.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 5;</code>
     */
    private $create_time = null;
    /**
     * The time when the File was last updated.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 6;</code>
     */
    private $update_time = null;
    /**
     * The name of the Package or Version that owns this file, if any.
     *
     * Generated from protobuf field <code>string owner = 7;</code>
     */
    private $owner = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           The name of the file, for example:
     *           "projects/p1/locations/us-central1/repositories/repo1/files/a%2Fb%2Fc.txt".
     *           If the file ID part contains slashes, they are escaped.
     *     @type int|string $size_bytes
     *           The size of the File in bytes.
     *     @type array<\Google\Cloud\ArtifactRegistry\V1beta2\Hash>|\Google\Protobuf\Internal\RepeatedField $hashes
     *           The hashes of the file content.
     *     @type \Google\Protobuf\Timestamp $create_time
     *           The time when the File was created.
     *     @type \Google\Protobuf\Timestamp $update_time
     *           The time when the File was last updated.
     *     @type string $owner
     *           The name of the Package or Version that owns this file, if any.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Devtools\Artifactregistry\V1Beta2\File::initOnce();
        parent::__construct($data);
    }

    /**
     * The name of the file, for example:
     * "projects/p1/locations/us-central1/repositories/repo1/files/a%2Fb%2Fc.txt".
     * If the file ID part contains slashes, they are escaped.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * The name of the file, for example:
     * "projects/p1/locations/us-central1/repositories/repo1/files/a%2Fb%2Fc.txt".
     * If the file ID part contains slashes, they are escaped.
     *
     * 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 size of the File in bytes.
     *
     * Generated from protobuf field <code>int64 size_bytes = 3;</code>
     * @return int|string
     */
    public function getSizeBytes()
    {
        return $this->size_bytes;
    }

    /**
     * The size of the File in bytes.
     *
     * Generated from protobuf field <code>int64 size_bytes = 3;</code>
     * @param int|string $var
     * @return $this
     */
    public function setSizeBytes($var)
    {
        GPBUtil::checkInt64($var);
        $this->size_bytes = $var;

        return $this;
    }

    /**
     * The hashes of the file content.
     *
     * Generated from protobuf field <code>repeated .google.devtools.artifactregistry.v1beta2.Hash hashes = 4;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getHashes()
    {
        return $this->hashes;
    }

    /**
     * The hashes of the file content.
     *
     * Generated from protobuf field <code>repeated .google.devtools.artifactregistry.v1beta2.Hash hashes = 4;</code>
     * @param array<\Google\Cloud\ArtifactRegistry\V1beta2\Hash>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setHashes($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ArtifactRegistry\V1beta2\Hash::class);
        $this->hashes = $arr;

        return $this;
    }

    /**
     * The time when the File was created.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 5;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getCreateTime()
    {
        return $this->create_time;
    }

    public function hasCreateTime()
    {
        return isset($this->create_time);
    }

    public function clearCreateTime()
    {
        unset($this->create_time);
    }

    /**
     * The time when the File was created.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 5;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setCreateTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->create_time = $var;

        return $this;
    }

    /**
     * The time when the File was last updated.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 6;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getUpdateTime()
    {
        return $this->update_time;
    }

    public function hasUpdateTime()
    {
        return isset($this->update_time);
    }

    public function clearUpdateTime()
    {
        unset($this->update_time);
    }

    /**
     * The time when the File was last updated.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 6;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setUpdateTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->update_time = $var;

        return $this;
    }

    /**
     * The name of the Package or Version that owns this file, if any.
     *
     * Generated from protobuf field <code>string owner = 7;</code>
     * @return string
     */
    public function getOwner()
    {
        return $this->owner;
    }

    /**
     * The name of the Package or Version that owns this file, if any.
     *
     * Generated from protobuf field <code>string owner = 7;</code>
     * @param string $var
     * @return $this
     */
    public function setOwner($var)
    {
        GPBUtil::checkString($var, True);
        $this->owner = $var;

        return $this;
    }

}

