src/Sell/Account/V2/Model/RateTableDetails.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);
/**
* RateTableDetails.
*
* PHP version ^7.2 || ^8.0
*
* @category Class
*
* @author OpenAPI Generator team
*
* @see https://openapi-generator.tech
*/
/**
* Rate Table API.
*
* This API allows sellers to retrieve and manage their custom shipping rate tables.
*
* The version of the OpenAPI document: 2.0.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\Account\V2\Model;
use TNT\Ebay\Sell\Account\V2\ObjectSerializer;
/**
* RateTableDetails Class Doc Comment.
*
* @category Class
*
* @description This container includes all information pertaining to a shipping rate table. A successful call returns the requested shipping rate information.
*
* @author OpenAPI Generator team
*
* @see https://openapi-generator.tech
*
* @implements \ArrayAccess<TKey, TValue>
*
* @template TKey int|null
* @template TValue mixed|null
*/
class RateTableDetails implements ModelInterface, \ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'RateTableDetails';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $openAPITypes = [
'marketplace_id' => 'string',
'name' => 'string',
'rates' => '\TNT\Ebay\Sell\Account\V2\Model\Rate[]',
'rate_table_basis' => 'string',
'rate_table_id' => 'string',
'shipping_option_type' => '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 = [
'marketplace_id' => null,
'name' => null,
'rates' => null,
'rate_table_basis' => null,
'rate_table_id' => null,
'shipping_option_type' => 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 = [
'marketplace_id' => 'marketplaceId',
'name' => 'name',
'rates' => 'rates',
'rate_table_basis' => 'rateTableBasis',
'rate_table_id' => 'rateTableId',
'shipping_option_type' => 'shippingOptionType',
];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'marketplace_id' => 'setMarketplaceId',
'name' => 'setName',
'rates' => 'setRates',
'rate_table_basis' => 'setRateTableBasis',
'rate_table_id' => 'setRateTableId',
'shipping_option_type' => 'setShippingOptionType',
];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'marketplace_id' => 'getMarketplaceId',
'name' => 'getName',
'rates' => 'getRates',
'rate_table_basis' => 'getRateTableBasis',
'rate_table_id' => 'getRateTableId',
'shipping_option_type' => 'getShippingOptionType',
];
/**
* 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['marketplace_id'] = $data['marketplace_id'] ?? null;
$this->container['name'] = $data['name'] ?? null;
$this->container['rates'] = $data['rates'] ?? null;
$this->container['rate_table_basis'] = $data['rate_table_basis'] ?? null;
$this->container['rate_table_id'] = $data['rate_table_id'] ?? null;
$this->container['shipping_option_type'] = $data['shipping_option_type'] ?? 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 marketplace_id.
*
* @return string|null
*/
public function getMarketplaceId()
{
return $this->container['marketplace_id'];
}
/**
* Sets marketplace_id.
*
* @param string|null $marketplace_id Identifies the eBay marketplace to which the shipping rate table applies. For implementation help, refer to <a href='https://developer.ebay.com/api-docs/sell/account/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 for the shipping rate table. Names must be unique for each table assigned to the same seller, shippingOptionType, and eBay marketplace.<br/><br/><b>Max length:</b> 50
*
* @return self
*/
public function setName($name)
{
$this->container['name'] = $name;
return $this;
}
/**
* Gets rates.
*
* @return \TNT\Ebay\Sell\Account\V2\Model\Rate[]|null
*/
public function getRates()
{
return $this->container['rates'];
}
/**
* Sets rates.
*
* @param \TNT\Ebay\Sell\Account\V2\Model\Rate[]|null $rates An array of rate objects associated with the specified shipping rate table. Each rate object is identified by a unique system-generated ID and defines specific shipping rate information.
*
* @return self
*/
public function setRates($rates)
{
$this->container['rates'] = $rates;
return $this;
}
/**
* Gets rate_table_basis.
*
* @return string|null
*/
public function getRateTableBasis()
{
return $this->container['rate_table_basis'];
}
/**
* Sets rate_table_basis.
*
* @param string|null $rate_table_basis The rate calculation type provides three methods of calculating the shipping cost based on the seller's selection/input:<ul><li><b>ITEM</b>: Specifies the flat rate shipping cost that buyers in the specified shipping region will pay. When this option is selected, information specified in the rate table overrides all shipping options/costs that are specified at the listing level. Buyers in the specified regions will only see the services provided in the rate table. Buyers in other regions that are not specified in the rate table will see the shipping services associated with the listing.</li><li><b>WEIGHT</b>: Seller can provide minimum shipping cost and an additional shipping cost per pound. The additional cost will be calculated based on the weight the seller provide at the time of listing. Buyers will see the total shipping cost and won’t see these calculations. Buyers in the specified regions will only see the services provided in the rate table. Buyers in other regions that were not specified in the rate table, will see the shipping services associated with the listing.</li><li><b>SURCHARGE</b>: Lists surcharges for buyers within specified regions, or indicates a flat amount added to the shipping cost specified within an item's listing. Buyers will see only the total shipping cost as well as shipping services associated with the item's listing. If a SURCHARGE is specified in the rate table for certain regions, buyers in those regions will see the (shipping cost + SURCHARGE) total.</li></ul> For implementation help, refer to <a href='https://developer.ebay.com/api-docs/sell/account/types/api:ShippingRateCalculationEnum'>eBay API documentation</a>
*
* @return self
*/
public function setRateTableBasis($rate_table_basis)
{
$this->container['rate_table_basis'] = $rate_table_basis;
return $this;
}
/**
* Gets rate_table_id.
*
* @return string|null
*/
public function getRateTableId()
{
return $this->container['rate_table_id'];
}
/**
* Sets rate_table_id.
*
* @param string|null $rate_table_id a unique, system-generated ID assigned to the shipping rate table when it is initially created
*
* @return self
*/
public function setRateTableId($rate_table_id)
{
$this->container['rate_table_id'] = $rate_table_id;
return $this;
}
/**
* Gets shipping_option_type.
*
* @return string|null
*/
public function getShippingOptionType()
{
return $this->container['shipping_option_type'];
}
/**
* Sets shipping_option_type.
*
* @param string|null $shipping_option_type The region serviced by the shipping rate table. Valid values are:<ul><li><b>DOMESTIC</b>: Indicates that the shipping rate table applies to shipping destinations within the country in which an item has been listed (i.e., the <i>source</i> country).</li><li><b>INTERNATIONAL</b>: Indicates that the shipping rate table applies to shipping destinations outside of the country in which an item has been listed.</li></ul> For implementation help, refer to <a href='https://developer.ebay.com/api-docs/sell/account/types/api:ShippingOptionTypeEnum'>eBay API documentation</a>
*
* @return self
*/
public function setShippingOptionType($shipping_option_type)
{
$this->container['shipping_option_type'] = $shipping_option_type;
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));
}
}