src/Sell/Marketing/V1/Model/ItemPromotionResponse.php
<?php
/**
* This file is part of the trollandtoad/ebay-sdk-php package.
*
* MIT License
*
* Copyright (c) 2022 Brandon Clothier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
declare(strict_types=1);
/**
* ItemPromotionResponse.
*
* PHP version ^7.2 || ^8.0
*
* @category Class
*
* @author OpenAPI Generator team
*
* @see https://openapi-generator.tech
*/
/**
* Marketing API.
*
* <p>The <i>Marketing API </i> offers two platforms that sellers can use to promote and advertise their products:</p> <ul><li><b>Promoted Listings</b> is an eBay ad service that lets sellers set up <i>ad campaigns </i> for the products they want to promote. eBay displays the ads in search results and in other marketing modules as <b>SPONSORED</b> listings. If an item in a Promoted Listings campaign sells, the seller is assessed a Promoted Listings fee, which is a seller-specified percentage applied to the sales price. For complete details, refer to the <a href=\"/api-docs/sell/static/marketing/pl-landing.html\">Promoted Listings playbook</a>.</li><li><b>Promotions Manager</b> gives sellers a way to offer discounts on specific items as a way to attract buyers to their inventory. Sellers can set up discounts (such as \"20% off\" and other types of offers) on specific items or on an entire customer order. To further attract buyers, eBay prominently displays promotion <i>teasers</i> throughout buyer flows. For complete details, see <a href=\"/api-docs/sell/static/marketing/promotions-manager.html\">Promotions Manager</a>.</li></ul> <p><b>Marketing reports</b>, on both the Promoted Listings and Promotions Manager platforms, give sellers information that shows the effectiveness of their marketing strategies. The data gives sellers the ability to review and fine tune their marketing efforts.</p> <p class=\"tablenote\"><b>Important!</b> Sellers must have an active eBay Store subscription, and they must accept the <b>Terms and Conditions</b> before they can make requests to these APIs in the Production environment. There are also site-specific listings requirements and restrictions associated with these marketing tools, as listed in the \"requirements and restrictions\" sections for <a href=\"/api-docs/sell/marketing/static/overview.html#PL-requirements\">Promoted Listings</a> and <a href=\"/api-docs/sell/marketing/static/overview.html#PM-requirements\">Promotions Manager</a>.</p> <p>The table below lists all the Marketing API calls grouped by resource.</p>
*
* The version of the OpenAPI document: v1.14.0
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 5.4.0
*/
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace TNT\Ebay\Sell\Marketing\V1\Model;
use TNT\Ebay\Sell\Marketing\V1\ObjectSerializer;
/**
* ItemPromotionResponse Class Doc Comment.
*
* @category Class
*
* @description This complex type defines the fields returned for an item (threshold) promotion.
*
* @author OpenAPI Generator team
*
* @see https://openapi-generator.tech
*
* @implements \ArrayAccess<TKey, TValue>
*
* @template TKey int|null
* @template TValue mixed|null
*/
class ItemPromotionResponse implements ModelInterface, \ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'ItemPromotionResponse';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $openAPITypes = [
'apply_discount_to_single_item_only' => 'bool',
'budget' => '\TNT\Ebay\Sell\Marketing\V1\Model\Amount',
'coupon_configuration' => '\TNT\Ebay\Sell\Marketing\V1\Model\CouponConfiguration',
'description' => 'string',
'discount_rules' => '\TNT\Ebay\Sell\Marketing\V1\Model\DiscountRule[]',
'end_date' => 'string',
'inventory_criterion' => '\TNT\Ebay\Sell\Marketing\V1\Model\InventoryCriterion',
'marketplace_id' => 'string',
'name' => 'string',
'priority' => 'string',
'promotion_id' => 'string',
'promotion_image_url' => 'string',
'promotion_status' => 'string',
'promotion_type' => 'string',
'start_date' => 'string',
];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*
* @phpstan-var array<string, string|null>
*
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'apply_discount_to_single_item_only' => null,
'budget' => null,
'coupon_configuration' => null,
'description' => null,
'discount_rules' => null,
'end_date' => null,
'inventory_criterion' => null,
'marketplace_id' => null,
'name' => null,
'priority' => null,
'promotion_id' => null,
'promotion_image_url' => null,
'promotion_status' => null,
'promotion_type' => null,
'start_date' => null,
];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'apply_discount_to_single_item_only' => 'applyDiscountToSingleItemOnly',
'budget' => 'budget',
'coupon_configuration' => 'couponConfiguration',
'description' => 'description',
'discount_rules' => 'discountRules',
'end_date' => 'endDate',
'inventory_criterion' => 'inventoryCriterion',
'marketplace_id' => 'marketplaceId',
'name' => 'name',
'priority' => 'priority',
'promotion_id' => 'promotionId',
'promotion_image_url' => 'promotionImageUrl',
'promotion_status' => 'promotionStatus',
'promotion_type' => 'promotionType',
'start_date' => 'startDate',
];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'apply_discount_to_single_item_only' => 'setApplyDiscountToSingleItemOnly',
'budget' => 'setBudget',
'coupon_configuration' => 'setCouponConfiguration',
'description' => 'setDescription',
'discount_rules' => 'setDiscountRules',
'end_date' => 'setEndDate',
'inventory_criterion' => 'setInventoryCriterion',
'marketplace_id' => 'setMarketplaceId',
'name' => 'setName',
'priority' => 'setPriority',
'promotion_id' => 'setPromotionId',
'promotion_image_url' => 'setPromotionImageUrl',
'promotion_status' => 'setPromotionStatus',
'promotion_type' => 'setPromotionType',
'start_date' => 'setStartDate',
];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'apply_discount_to_single_item_only' => 'getApplyDiscountToSingleItemOnly',
'budget' => 'getBudget',
'coupon_configuration' => 'getCouponConfiguration',
'description' => 'getDescription',
'discount_rules' => 'getDiscountRules',
'end_date' => 'getEndDate',
'inventory_criterion' => 'getInventoryCriterion',
'marketplace_id' => 'getMarketplaceId',
'name' => 'getName',
'priority' => 'getPriority',
'promotion_id' => 'getPromotionId',
'promotion_image_url' => 'getPromotionImageUrl',
'promotion_status' => 'getPromotionStatus',
'promotion_type' => 'getPromotionType',
'start_date' => 'getStartDate',
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['apply_discount_to_single_item_only'] = $data['apply_discount_to_single_item_only'] ?? null;
$this->container['budget'] = $data['budget'] ?? null;
$this->container['coupon_configuration'] = $data['coupon_configuration'] ?? null;
$this->container['description'] = $data['description'] ?? null;
$this->container['discount_rules'] = $data['discount_rules'] ?? null;
$this->container['end_date'] = $data['end_date'] ?? null;
$this->container['inventory_criterion'] = $data['inventory_criterion'] ?? null;
$this->container['marketplace_id'] = $data['marketplace_id'] ?? null;
$this->container['name'] = $data['name'] ?? null;
$this->container['priority'] = $data['priority'] ?? null;
$this->container['promotion_id'] = $data['promotion_id'] ?? null;
$this->container['promotion_image_url'] = $data['promotion_image_url'] ?? null;
$this->container['promotion_status'] = $data['promotion_status'] ?? null;
$this->container['promotion_type'] = $data['promotion_type'] ?? null;
$this->container['start_date'] = $data['start_date'] ?? null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets apply_discount_to_single_item_only.
*
* @return bool|null
*/
public function getApplyDiscountToSingleItemOnly()
{
return $this->container['apply_discount_to_single_item_only'];
}
/**
* Sets apply_discount_to_single_item_only.
*
* @param bool|null $apply_discount_to_single_item_only If set to <code>true</code>, the discount is applied only when the buyer purchases multiple quantities of a single item in the promotion. Otherwise, the promotional discount applies to multiple quantities of any items in the promotion. Different variations of a multi-variation item are considered to be the same item. Note that this flag is not relevant if the <b>inventoryCriterion</b> container identifies a single listing ID for the promotion.
*
* @return self
*/
public function setApplyDiscountToSingleItemOnly($apply_discount_to_single_item_only)
{
$this->container['apply_discount_to_single_item_only'] = $apply_discount_to_single_item_only;
return $this;
}
/**
* Gets budget.
*
* @return \TNT\Ebay\Sell\Marketing\V1\Model\Amount|null
*/
public function getBudget()
{
return $this->container['budget'];
}
/**
* Sets budget.
*
* @param \TNT\Ebay\Sell\Marketing\V1\Model\Amount|null $budget budget
*
* @return self
*/
public function setBudget($budget)
{
$this->container['budget'] = $budget;
return $this;
}
/**
* Gets coupon_configuration.
*
* @return \TNT\Ebay\Sell\Marketing\V1\Model\CouponConfiguration|null
*/
public function getCouponConfiguration()
{
return $this->container['coupon_configuration'];
}
/**
* Sets coupon_configuration.
*
* @param \TNT\Ebay\Sell\Marketing\V1\Model\CouponConfiguration|null $coupon_configuration coupon_configuration
*
* @return self
*/
public function setCouponConfiguration($coupon_configuration)
{
$this->container['coupon_configuration'] = $coupon_configuration;
return $this;
}
/**
* Gets description.
*
* @return string|null
*/
public function getDescription()
{
return $this->container['description'];
}
/**
* Sets description.
*
* @param string|null $description Required for CODED_COUPON promotions, this is the seller-defined \"tag line\" for the offer, such as \"Save on designer shoes.\" The tag line appears under the \"offer-type text\" that is generated for the promotion and is displayed under the offer tile that is shown on the seller's <b>All Offers</b> page and on the event page for the promotion. This tag line is not used with volume pricing promotions. <p class=\"tablenote\"><b>Note:</b> Offer-type text is a teaser that's presented throughout the buyer's journey through the sales flow and is generated by eBay. This text is not editable by the seller—it's derived from the settings in the <b>discountRules</b> and <b>discountSpecification</b> fields—and can be, for example, \"Extra 20% off when you buy 3+\".</p> <br><b>Maximum length:</b> 50
*
* @return self
*/
public function setDescription($description)
{
$this->container['description'] = $description;
return $this;
}
/**
* Gets discount_rules.
*
* @return \TNT\Ebay\Sell\Marketing\V1\Model\DiscountRule[]|null
*/
public function getDiscountRules()
{
return $this->container['discount_rules'];
}
/**
* Sets discount_rules.
*
* @param \TNT\Ebay\Sell\Marketing\V1\Model\DiscountRule[]|null $discount_rules a list containing the promotion benefits (<b>discountRule</b>) and the rules that define when the benefit is applied (<b>discountSpecification</b>)
*
* @return self
*/
public function setDiscountRules($discount_rules)
{
$this->container['discount_rules'] = $discount_rules;
return $this;
}
/**
* Gets end_date.
*
* @return string|null
*/
public function getEndDate()
{
return $this->container['end_date'];
}
/**
* Sets end_date.
*
* @param string|null $end_date The date and time the promotion ends in UTC format (<code>yyyy-MM-ddThh:mm:ssZ</code>). For display purposes, convert this time into the local time of the seller.
*
* @return self
*/
public function setEndDate($end_date)
{
$this->container['end_date'] = $end_date;
return $this;
}
/**
* Gets inventory_criterion.
*
* @return \TNT\Ebay\Sell\Marketing\V1\Model\InventoryCriterion|null
*/
public function getInventoryCriterion()
{
return $this->container['inventory_criterion'];
}
/**
* Sets inventory_criterion.
*
* @param \TNT\Ebay\Sell\Marketing\V1\Model\InventoryCriterion|null $inventory_criterion inventory_criterion
*
* @return self
*/
public function setInventoryCriterion($inventory_criterion)
{
$this->container['inventory_criterion'] = $inventory_criterion;
return $this;
}
/**
* Gets marketplace_id.
*
* @return string|null
*/
public function getMarketplaceId()
{
return $this->container['marketplace_id'];
}
/**
* Sets marketplace_id.
*
* @param string|null $marketplace_id The eBay marketplace ID of the site where the threshold promotion is hosted. Threshold promotions are currently supported on a limited number of eBay marketplaces. <p><b>Valid values:</b></p> <ul class=\"compact\"><li><code>EBAY_AU</code> = Australia</li> <li><code>EBAY_DE</code> = Germany</li> <li><code>EBAY_ES</code> = Spain</li> <li><code>EBAY_FR</code> = France</li> <li><code>EBAY_GB</code> = Great Britain</li> <li><code>EBAY_IT</code> = Italy</li> <li><code>EBAY_US</code> = United States</li></ul> For implementation help, refer to <a href='https://developer.ebay.com/api-docs/sell/marketing/types/ba:MarketplaceIdEnum'>eBay API documentation</a>
*
* @return self
*/
public function setMarketplaceId($marketplace_id)
{
$this->container['marketplace_id'] = $marketplace_id;
return $this;
}
/**
* Gets name.
*
* @return string|null
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name.
*
* @param string|null $name The seller-defined name or \"title\" of the promotion that the seller can use to identify a promotion. This label is not displayed in end-user flows. <br><br><b>Maximum length:</b> 90
*
* @return self
*/
public function setName($name)
{
$this->container['name'] = $name;
return $this;
}
/**
* Gets priority.
*
* @return string|null
*/
public function getPriority()
{
return $this->container['priority'];
}
/**
* Sets priority.
*
* @param string|null $priority Applicable for only <b>ORDER_DISCOUNT</b> promotions, this field indicates the precedence of the promotion, which eBay uses to determine the position of a promotion on the seller's <b>All Offers</b> page. If an item is associated with multiple promotions, the promotion with the higher priority takes precedence. For implementation help, refer to <a href='https://developer.ebay.com/api-docs/sell/marketing/types/sme:PromotionPriorityEnum'>eBay API documentation</a>
*
* @return self
*/
public function setPriority($priority)
{
$this->container['priority'] = $priority;
return $this;
}
/**
* Gets promotion_id.
*
* @return string|null
*/
public function getPromotionId()
{
return $this->container['promotion_id'];
}
/**
* Sets promotion_id.
*
* @param string|null $promotion_id a unique eBay-assigned ID for the promotion that's generated when the promotion is created
*
* @return self
*/
public function setPromotionId($promotion_id)
{
$this->container['promotion_id'] = $promotion_id;
return $this;
}
/**
* Gets promotion_image_url.
*
* @return string|null
*/
public function getPromotionImageUrl()
{
return $this->container['promotion_image_url'];
}
/**
* Sets promotion_image_url.
*
* @param string|null $promotion_image_url Required for CODED_COUPON, MARKDOWN_SALE, and ORDER_DISCOUNT promotions, and not applicable for <b>VOLUME_DISCOUNT</b> promotions, this field is a URL that points to an image for the promotion. This image is displayed on the seller's <b>All Offers</b> page. The URL must point to either JPEG or PNG image and it must be a minimum of 500x500 pixels in dimension and cannot exceed 12Mb in size.
*
* @return self
*/
public function setPromotionImageUrl($promotion_image_url)
{
$this->container['promotion_image_url'] = $promotion_image_url;
return $this;
}
/**
* Gets promotion_status.
*
* @return string|null
*/
public function getPromotionStatus()
{
return $this->container['promotion_status'];
}
/**
* Sets promotion_status.
*
* @param string|null $promotion_status The current status of the promotion. When creating a new promotion, this value must be set to either <code>DRAFT</code> or <code>SCHEDULED</code>. For implementation help, refer to <a href='https://developer.ebay.com/api-docs/sell/marketing/types/sme:PromotionStatusEnum'>eBay API documentation</a>
*
* @return self
*/
public function setPromotionStatus($promotion_status)
{
$this->container['promotion_status'] = $promotion_status;
return $this;
}
/**
* Gets promotion_type.
*
* @return string|null
*/
public function getPromotionType()
{
return $this->container['promotion_type'];
}
/**
* Sets promotion_type.
*
* @param string|null $promotion_type Indicates the type of the promotion, either <code>CODED_COUPON</code>, <code>MARKDOWN_SALE</code>, <code>ORDER_DISCOUNT</code>, or <code>VOLUME_DISCOUNT</code>. For implementation help, refer to <a href='https://developer.ebay.com/api-docs/sell/marketing/types/sme:PromotionTypeEnum'>eBay API documentation</a>
*
* @return self
*/
public function setPromotionType($promotion_type)
{
$this->container['promotion_type'] = $promotion_type;
return $this;
}
/**
* Gets start_date.
*
* @return string|null
*/
public function getStartDate()
{
return $this->container['start_date'];
}
/**
* Sets start_date.
*
* @param string|null $start_date The date and time the promotion starts in UTC format (<code>yyyy-MM-ddThh:mm:ssZ</code>). For display purposes, convert this time into the local time of the seller.
*
* @return self
*/
public function setStartDate($start_date)
{
$this->container['start_date'] = $start_date;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*/
public function offsetSet($offset, $value): void
{
if (null === $offset) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
*
* @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
/**
* Gets a header-safe presentation of the object.
*
* @return string
*/
public function toHeaderValue()
{
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}