<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/retail/v2/user_event.proto

namespace Google\Cloud\Retail\V2;

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

/**
 * A transaction represents the entire purchase transaction.
 *
 * Generated from protobuf message <code>google.cloud.retail.v2.PurchaseTransaction</code>
 */
class PurchaseTransaction extends \Google\Protobuf\Internal\Message
{
    /**
     * The transaction ID with a length limit of 128 characters.
     *
     * Generated from protobuf field <code>string id = 1;</code>
     */
    private $id = '';
    /**
     * Required. Total non-zero revenue or grand total associated with the
     * transaction. This value include shipping, tax, or other adjustments to
     * total revenue that you want to include as part of your revenue
     * calculations.
     *
     * Generated from protobuf field <code>float revenue = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $revenue = 0.0;
    /**
     * All the taxes associated with the transaction.
     *
     * Generated from protobuf field <code>float tax = 3;</code>
     */
    private $tax = 0.0;
    /**
     * All the costs associated with the products. These can be manufacturing
     * costs, shipping expenses not borne by the end user, or any other costs,
     * such that:
     * * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
     * [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
     * [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
     *
     * Generated from protobuf field <code>float cost = 4;</code>
     */
    private $cost = 0.0;
    /**
     * Required. Currency code. Use three-character ISO-4217 code.
     *
     * Generated from protobuf field <code>string currency_code = 5 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $currency_code = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $id
     *           The transaction ID with a length limit of 128 characters.
     *     @type float $revenue
     *           Required. Total non-zero revenue or grand total associated with the
     *           transaction. This value include shipping, tax, or other adjustments to
     *           total revenue that you want to include as part of your revenue
     *           calculations.
     *     @type float $tax
     *           All the taxes associated with the transaction.
     *     @type float $cost
     *           All the costs associated with the products. These can be manufacturing
     *           costs, shipping expenses not borne by the end user, or any other costs,
     *           such that:
     *           * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
     *           [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
     *           [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
     *     @type string $currency_code
     *           Required. Currency code. Use three-character ISO-4217 code.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Retail\V2\UserEvent::initOnce();
        parent::__construct($data);
    }

    /**
     * The transaction ID with a length limit of 128 characters.
     *
     * Generated from protobuf field <code>string id = 1;</code>
     * @return string
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * The transaction ID with a length limit of 128 characters.
     *
     * Generated from protobuf field <code>string id = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setId($var)
    {
        GPBUtil::checkString($var, True);
        $this->id = $var;

        return $this;
    }

    /**
     * Required. Total non-zero revenue or grand total associated with the
     * transaction. This value include shipping, tax, or other adjustments to
     * total revenue that you want to include as part of your revenue
     * calculations.
     *
     * Generated from protobuf field <code>float revenue = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return float
     */
    public function getRevenue()
    {
        return $this->revenue;
    }

    /**
     * Required. Total non-zero revenue or grand total associated with the
     * transaction. This value include shipping, tax, or other adjustments to
     * total revenue that you want to include as part of your revenue
     * calculations.
     *
     * Generated from protobuf field <code>float revenue = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param float $var
     * @return $this
     */
    public function setRevenue($var)
    {
        GPBUtil::checkFloat($var);
        $this->revenue = $var;

        return $this;
    }

    /**
     * All the taxes associated with the transaction.
     *
     * Generated from protobuf field <code>float tax = 3;</code>
     * @return float
     */
    public function getTax()
    {
        return $this->tax;
    }

    /**
     * All the taxes associated with the transaction.
     *
     * Generated from protobuf field <code>float tax = 3;</code>
     * @param float $var
     * @return $this
     */
    public function setTax($var)
    {
        GPBUtil::checkFloat($var);
        $this->tax = $var;

        return $this;
    }

    /**
     * All the costs associated with the products. These can be manufacturing
     * costs, shipping expenses not borne by the end user, or any other costs,
     * such that:
     * * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
     * [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
     * [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
     *
     * Generated from protobuf field <code>float cost = 4;</code>
     * @return float
     */
    public function getCost()
    {
        return $this->cost;
    }

    /**
     * All the costs associated with the products. These can be manufacturing
     * costs, shipping expenses not borne by the end user, or any other costs,
     * such that:
     * * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
     * [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
     * [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
     *
     * Generated from protobuf field <code>float cost = 4;</code>
     * @param float $var
     * @return $this
     */
    public function setCost($var)
    {
        GPBUtil::checkFloat($var);
        $this->cost = $var;

        return $this;
    }

    /**
     * Required. Currency code. Use three-character ISO-4217 code.
     *
     * Generated from protobuf field <code>string currency_code = 5 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getCurrencyCode()
    {
        return $this->currency_code;
    }

    /**
     * Required. Currency code. Use three-character ISO-4217 code.
     *
     * Generated from protobuf field <code>string currency_code = 5 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setCurrencyCode($var)
    {
        GPBUtil::checkString($var, True);
        $this->currency_code = $var;

        return $this;
    }

}

