<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/shopping/merchant/products/v1/products_common.proto

namespace Google\Shopping\Merchant\Products\V1;

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

/**
 * The weight of the product.
 *
 * Generated from protobuf message <code>google.shopping.merchant.products.v1.ProductWeight</code>
 */
class ProductWeight extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The weight represented as a number. The weight can have a maximum
     * precision of four decimal places.
     *
     * Generated from protobuf field <code>double value = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $value = 0.0;
    /**
     * Required. The weight unit.
     * Acceptable values are:
     *   * "`g`"
     *   * "`kg`"
     *   * "`oz`"
     *   * "`lb`"
     *
     * Generated from protobuf field <code>string unit = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $unit = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type float $value
     *           Required. The weight represented as a number. The weight can have a maximum
     *           precision of four decimal places.
     *     @type string $unit
     *           Required. The weight unit.
     *           Acceptable values are:
     *             * "`g`"
     *             * "`kg`"
     *             * "`oz`"
     *             * "`lb`"
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Shopping\Merchant\Products\V1\ProductsCommon::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The weight represented as a number. The weight can have a maximum
     * precision of four decimal places.
     *
     * Generated from protobuf field <code>double value = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return float
     */
    public function getValue()
    {
        return $this->value;
    }

    /**
     * Required. The weight represented as a number. The weight can have a maximum
     * precision of four decimal places.
     *
     * Generated from protobuf field <code>double value = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param float $var
     * @return $this
     */
    public function setValue($var)
    {
        GPBUtil::checkDouble($var);
        $this->value = $var;

        return $this;
    }

    /**
     * Required. The weight unit.
     * Acceptable values are:
     *   * "`g`"
     *   * "`kg`"
     *   * "`oz`"
     *   * "`lb`"
     *
     * Generated from protobuf field <code>string unit = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getUnit()
    {
        return $this->unit;
    }

    /**
     * Required. The weight unit.
     * Acceptable values are:
     *   * "`g`"
     *   * "`kg`"
     *   * "`oz`"
     *   * "`lb`"
     *
     * Generated from protobuf field <code>string unit = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setUnit($var)
    {
        GPBUtil::checkString($var, True);
        $this->unit = $var;

        return $this;
    }

}

