<?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\ProductAttributes;

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

/**
 * The co2 emission of the vehicle.
 *
 * Generated from protobuf message <code>google.shopping.merchant.products.v1.ProductAttributes.Co2Emissions</code>
 */
class Co2Emissions extends \Google\Protobuf\Internal\Message
{
    /**
     * The co2 emission value.
     *
     * Generated from protobuf field <code>optional int64 value = 1;</code>
     */
    protected $value = null;
    /**
     * The unit of the co2 emission.
     *
     * Generated from protobuf field <code>.google.shopping.merchant.products.v1.ProductAttributes.Co2Emissions.Unit unit = 2;</code>
     */
    protected $unit = 0;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int|string $value
     *           The co2 emission value.
     *     @type int $unit
     *           The unit of the co2 emission.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Shopping\Merchant\Products\V1\ProductsCommon::initOnce();
        parent::__construct($data);
    }

    /**
     * The co2 emission value.
     *
     * Generated from protobuf field <code>optional int64 value = 1;</code>
     * @return int|string
     */
    public function getValue()
    {
        return isset($this->value) ? $this->value : 0;
    }

    public function hasValue()
    {
        return isset($this->value);
    }

    public function clearValue()
    {
        unset($this->value);
    }

    /**
     * The co2 emission value.
     *
     * Generated from protobuf field <code>optional int64 value = 1;</code>
     * @param int|string $var
     * @return $this
     */
    public function setValue($var)
    {
        GPBUtil::checkInt64($var);
        $this->value = $var;

        return $this;
    }

    /**
     * The unit of the co2 emission.
     *
     * Generated from protobuf field <code>.google.shopping.merchant.products.v1.ProductAttributes.Co2Emissions.Unit unit = 2;</code>
     * @return int
     */
    public function getUnit()
    {
        return $this->unit;
    }

    /**
     * The unit of the co2 emission.
     *
     * Generated from protobuf field <code>.google.shopping.merchant.products.v1.ProductAttributes.Co2Emissions.Unit unit = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setUnit($var)
    {
        GPBUtil::checkEnum($var, \Google\Shopping\Merchant\Products\V1\ProductAttributes\Co2Emissions\Unit::class);
        $this->unit = $var;

        return $this;
    }

}

