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

namespace Grafeas\V1;

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

/**
 * Request to create occurrences in batch.
 *
 * Generated from protobuf message <code>grafeas.v1.BatchCreateOccurrencesRequest</code>
 */
class BatchCreateOccurrencesRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * The name of the project in the form of `projects/[PROJECT_ID]`, under which
     * the occurrences are to be created.
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     */
    protected $parent = '';
    /**
     * The occurrences to create. Max allowed length is 1000.
     *
     * Generated from protobuf field <code>repeated .grafeas.v1.Occurrence occurrences = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $occurrences;

    /**
     * @param string                   $parent      The name of the project in the form of `projects/[PROJECT_ID]`, under which
     *                                              the occurrences are to be created. Please see
     *                                              {@see GrafeasClient::projectName()} for help formatting this field.
     * @param \Grafeas\V1\Occurrence[] $occurrences The occurrences to create. Max allowed length is 1000.
     *
     * @return \Grafeas\V1\BatchCreateOccurrencesRequest
     *
     * @experimental
     */
    public static function build(string $parent, array $occurrences): self
    {
        return (new self())
            ->setParent($parent)
            ->setOccurrences($occurrences);
    }

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $parent
     *           The name of the project in the form of `projects/[PROJECT_ID]`, under which
     *           the occurrences are to be created.
     *     @type \Grafeas\V1\Occurrence[] $occurrences
     *           The occurrences to create. Max allowed length is 1000.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Grafeas\V1\Grafeas::initOnce();
        parent::__construct($data);
    }

    /**
     * The name of the project in the form of `projects/[PROJECT_ID]`, under which
     * the occurrences are to be created.
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getParent()
    {
        return $this->parent;
    }

    /**
     * The name of the project in the form of `projects/[PROJECT_ID]`, under which
     * the occurrences are to be created.
     *
     * Generated from protobuf field <code>string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setParent($var)
    {
        GPBUtil::checkString($var, True);
        $this->parent = $var;

        return $this;
    }

    /**
     * The occurrences to create. Max allowed length is 1000.
     *
     * Generated from protobuf field <code>repeated .grafeas.v1.Occurrence occurrences = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return RepeatedField<\Grafeas\V1\Occurrence>
     */
    public function getOccurrences()
    {
        return $this->occurrences;
    }

    /**
     * The occurrences to create. Max allowed length is 1000.
     *
     * Generated from protobuf field <code>repeated .grafeas.v1.Occurrence occurrences = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Grafeas\V1\Occurrence[] $var
     * @return $this
     */
    public function setOccurrences($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\Occurrence::class);
        $this->occurrences = $arr;

        return $this;
    }

}

