brandon14/ebay-sdk-php

View on GitHub
src/Sell/Marketing/V1/Model/ItemPriceMarkdown.php

Summary

Maintainability
F
1 wk
Test Coverage
<?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);

/**
 * ItemPriceMarkdown.
 *
 * 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;

/**
 * ItemPriceMarkdown Class Doc Comment.
 *
 * @category Class
 *
 * @description This type defines the fields used to describe an item price markdown promotion.
 *
 * @author   OpenAPI Generator team
 *
 * @see     https://openapi-generator.tech
 *
 * @implements \ArrayAccess<TKey, TValue>
 *
 * @template TKey int|null
 * @template TValue mixed|null
 */
class ItemPriceMarkdown implements ModelInterface, \ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

    /**
     * The original name of the model.
     *
     * @var string
     */
    protected static $openAPIModelName = 'ItemPriceMarkdown';

    /**
     * Array of property to type mappings. Used for (de)serialization.
     *
     * @var string[]
     */
    protected static $openAPITypes = [
        'apply_free_shipping' => 'bool',
        'auto_select_future_inventory' => 'bool',
        'block_price_increase_in_item_revision' => 'bool',
        'description' => 'string',
        'end_date' => 'string',
        'marketplace_id' => 'string',
        'name' => 'string',
        'priority' => 'string',
        'promotion_image_url' => 'string',
        'promotion_status' => 'string',
        'selected_inventory_discounts' => '\TNT\Ebay\Sell\Marketing\V1\Model\SelectedInventoryDiscount[]',
        '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_free_shipping' => null,
        'auto_select_future_inventory' => null,
        'block_price_increase_in_item_revision' => null,
        'description' => null,
        'end_date' => null,
        'marketplace_id' => null,
        'name' => null,
        'priority' => null,
        'promotion_image_url' => null,
        'promotion_status' => null,
        'selected_inventory_discounts' => 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_free_shipping' => 'applyFreeShipping',
        'auto_select_future_inventory' => 'autoSelectFutureInventory',
        'block_price_increase_in_item_revision' => 'blockPriceIncreaseInItemRevision',
        'description' => 'description',
        'end_date' => 'endDate',
        'marketplace_id' => 'marketplaceId',
        'name' => 'name',
        'priority' => 'priority',
        'promotion_image_url' => 'promotionImageUrl',
        'promotion_status' => 'promotionStatus',
        'selected_inventory_discounts' => 'selectedInventoryDiscounts',
        'start_date' => 'startDate',
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses).
     *
     * @var string[]
     */
    protected static $setters = [
        'apply_free_shipping' => 'setApplyFreeShipping',
        'auto_select_future_inventory' => 'setAutoSelectFutureInventory',
        'block_price_increase_in_item_revision' => 'setBlockPriceIncreaseInItemRevision',
        'description' => 'setDescription',
        'end_date' => 'setEndDate',
        'marketplace_id' => 'setMarketplaceId',
        'name' => 'setName',
        'priority' => 'setPriority',
        'promotion_image_url' => 'setPromotionImageUrl',
        'promotion_status' => 'setPromotionStatus',
        'selected_inventory_discounts' => 'setSelectedInventoryDiscounts',
        'start_date' => 'setStartDate',
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests).
     *
     * @var string[]
     */
    protected static $getters = [
        'apply_free_shipping' => 'getApplyFreeShipping',
        'auto_select_future_inventory' => 'getAutoSelectFutureInventory',
        'block_price_increase_in_item_revision' => 'getBlockPriceIncreaseInItemRevision',
        'description' => 'getDescription',
        'end_date' => 'getEndDate',
        'marketplace_id' => 'getMarketplaceId',
        'name' => 'getName',
        'priority' => 'getPriority',
        'promotion_image_url' => 'getPromotionImageUrl',
        'promotion_status' => 'getPromotionStatus',
        'selected_inventory_discounts' => 'getSelectedInventoryDiscounts',
        '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_free_shipping'] = $data['apply_free_shipping'] ?? null;
        $this->container['auto_select_future_inventory'] = $data['auto_select_future_inventory'] ?? null;
        $this->container['block_price_increase_in_item_revision'] = $data['block_price_increase_in_item_revision'] ?? null;
        $this->container['description'] = $data['description'] ?? null;
        $this->container['end_date'] = $data['end_date'] ?? null;
        $this->container['marketplace_id'] = $data['marketplace_id'] ?? null;
        $this->container['name'] = $data['name'] ?? null;
        $this->container['priority'] = $data['priority'] ?? null;
        $this->container['promotion_image_url'] = $data['promotion_image_url'] ?? null;
        $this->container['promotion_status'] = $data['promotion_status'] ?? null;
        $this->container['selected_inventory_discounts'] = $data['selected_inventory_discounts'] ?? 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_free_shipping.
     *
     * @return bool|null
     */
    public function getApplyFreeShipping()
    {
        return $this->container['apply_free_shipping'];
    }

    /**
     * Sets apply_free_shipping.
     *
     * @param bool|null $apply_free_shipping If set to <code>true</code>, free shipping is applied to the first shipping service specified for the item. The first domestic shipping option is set to \"free shipping,\" regardless if the shipping <b>optionType</b> for that service is set to <code>FLAT_RATE</code>, <code>CALCULATED</code>, or <code>NOT_SPECIFIED</code> (freight). This flag essentially adds free shipping as a promotional bonus. <br><br><b>Default:</b> <code>false</code>
     *
     * @return self
     */
    public function setApplyFreeShipping($apply_free_shipping)
    {
        $this->container['apply_free_shipping'] = $apply_free_shipping;

        return $this;
    }

    /**
     * Gets auto_select_future_inventory.
     *
     * @return bool|null
     */
    public function getAutoSelectFutureInventory()
    {
        return $this->container['auto_select_future_inventory'];
    }

    /**
     * Sets auto_select_future_inventory.
     *
     * @param bool|null $auto_select_future_inventory If set to <code>true</code>, eBay will automatically add inventory items to the markdown promotion if they meet the <b>selectedInventoryDiscounts</b> criteria specified for the markdown promotion.  <br><br><b>Default:</b> <code>false</code>
     *
     * @return self
     */
    public function setAutoSelectFutureInventory($auto_select_future_inventory)
    {
        $this->container['auto_select_future_inventory'] = $auto_select_future_inventory;

        return $this;
    }

    /**
     * Gets block_price_increase_in_item_revision.
     *
     * @return bool|null
     */
    public function getBlockPriceIncreaseInItemRevision()
    {
        return $this->container['block_price_increase_in_item_revision'];
    }

    /**
     * Sets block_price_increase_in_item_revision.
     *
     * @param bool|null $block_price_increase_in_item_revision If set to <code>true</code>, price increases (including removing the free shipping flag) are blocked and an error message is returned if a seller attempts to adjust the price of an item that's partaking in this markdown promotion. If set to <code>false</code>, an item is dropped from the markdown promotion if the seller adjusts the price.  <br><br><b>Default:</b> <code>false</code>
     *
     * @return self
     */
    public function setBlockPriceIncreaseInItemRevision($block_price_increase_in_item_revision)
    {
        $this->container['block_price_increase_in_item_revision'] = $block_price_increase_in_item_revision;

        return $this;
    }

    /**
     * Gets description.
     *
     * @return string|null
     */
    public function getDescription()
    {
        return $this->container['description'];
    }

    /**
     * Sets description.
     *
     * @param string|null $description This field is required if you are configuring an MARKDOWN_SALE promotion. <br><br>This is the seller-defined \"tag line\" for the offer, such as \"Save on designer shoes.\" A tag line appears under the \"offer-type text\" that is generated for the promotion. The text is displayed on the offer tile that is shown on the seller's <b>All Offers</b> page and on the event page for the promotion.  <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&mdash;it's derived from the settings in the <b>discountRules</b> and <b>discountSpecification</b> fields&mdash;and can be, for example, \"20% off\".</p>  <br><b>Maximum length:</b> 50
     *
     * @return self
     */
    public function setDescription($description)
    {
        $this->container['description'] = $description;

        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>). The value supplied for <b>endDate</b> must be at least 24 hours after the value supplied for the <b>startDate</b> of the markdown promotion.<br><br>For display purposes, convert this time into the local time of the seller.  <br><br><b>Max value:</b><ul><li><code>14</code> days for the AT, CH, DE, ES, FR, IE, IT, and UK, marketplaces.</li>  <li><code>45</code> days for all other marketplaces.</li></ul>
     *
     * @return self
     */
    public function setEndDate($end_date)
    {
        $this->container['end_date'] = $end_date;

        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 markdown promotion is hosted. Markdown promotions are supported on all eBay marketplaces. 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 This field is ignored in markdown promotions. 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_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, populate this field with a URL that points to an image to be used with 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, you must set this value to either <code>DRAFT</code> or <code>SCHEDULED</code>.  <br><br>Note that you must set this value to <code>SCHEDULED</code> when you update a <b>RUNNING</b> promotion. 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 selected_inventory_discounts.
     *
     * @return \TNT\Ebay\Sell\Marketing\V1\Model\SelectedInventoryDiscount[]|null
     */
    public function getSelectedInventoryDiscounts()
    {
        return $this->container['selected_inventory_discounts'];
    }

    /**
     * Sets selected_inventory_discounts.
     *
     * @param \TNT\Ebay\Sell\Marketing\V1\Model\SelectedInventoryDiscount[]|null $selected_inventory_discounts a list that defines the sets of selected items for the markdown promotion and the discount specified for promotion
     *
     * @return self
     */
    public function setSelectedInventoryDiscounts($selected_inventory_discounts)
    {
        $this->container['selected_inventory_discounts'] = $selected_inventory_discounts;

        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));
    }
}