brandon14/ebay-sdk-php

View on GitHub
src/Buy/OfferBeta/V1/Model/Bidding.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);

/**
 * Bidding.
 *
 * PHP version ^7.2 || ^8.0
 *
 * @category Class
 *
 * @author   OpenAPI Generator team
 *
 * @see     https://openapi-generator.tech
 */

/**
 * Buy Offer API.
 *
 * <span class=\"tablenote\"><b>Note:</b> This is a <a href=\"https://developer.ebay.com/api-docs/static/versioning.html#limited\" target=\"_blank\"> <img src=\"/cms/img/docs/partners-api.svg\" class=\"legend-icon partners-icon\" title=\"Limited Release\"  alt=\"Limited Release\" />(Limited Release)</a> API available only to select developers approved by business units.</span><br /><br />The Buy Offer API enables Partners to place proxy bids for a buyer and retrieve the auctions where the buyer is bidding.  By placing a proxy bid, the buyer is agreeing to purchase the item if they win the auction. </p>
 *
 * The version of the OpenAPI document: v1_beta.0.1
 * 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\Buy\OfferBeta\V1\Model;

use TNT\Ebay\Buy\OfferBeta\V1\ObjectSerializer;

/**
 * Bidding Class Doc Comment.
 *
 * @category Class
 *
 * @description The type the defines the field for the auction details.
 *
 * @author   OpenAPI Generator team
 *
 * @see     https://openapi-generator.tech
 *
 * @implements \ArrayAccess<TKey, TValue>
 *
 * @template TKey int|null
 * @template TValue mixed|null
 */
class Bidding implements ModelInterface, \ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

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

    /**
     * Array of property to type mappings. Used for (de)serialization.
     *
     * @var string[]
     */
    protected static $openAPITypes = [
        'auction_end_date' => 'string',
        'auction_status' => 'string',
        'bid_count' => 'int',
        'current_price' => '\TNT\Ebay\Buy\OfferBeta\V1\Model\Amount',
        'current_proxy_bid' => '\TNT\Ebay\Buy\OfferBeta\V1\Model\ProxyBid',
        'high_bidder' => 'bool',
        'item_id' => 'string',
        'reserve_price_met' => 'bool',
        'suggested_bid_amounts' => '\TNT\Ebay\Buy\OfferBeta\V1\Model\Amount[]',
    ];

    /**
     * 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 = [
        'auction_end_date' => null,
        'auction_status' => null,
        'bid_count' => 'int32',
        'current_price' => null,
        'current_proxy_bid' => null,
        'high_bidder' => null,
        'item_id' => null,
        'reserve_price_met' => null,
        'suggested_bid_amounts' => 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 = [
        'auction_end_date' => 'auctionEndDate',
        'auction_status' => 'auctionStatus',
        'bid_count' => 'bidCount',
        'current_price' => 'currentPrice',
        'current_proxy_bid' => 'currentProxyBid',
        'high_bidder' => 'highBidder',
        'item_id' => 'itemId',
        'reserve_price_met' => 'reservePriceMet',
        'suggested_bid_amounts' => 'suggestedBidAmounts',
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses).
     *
     * @var string[]
     */
    protected static $setters = [
        'auction_end_date' => 'setAuctionEndDate',
        'auction_status' => 'setAuctionStatus',
        'bid_count' => 'setBidCount',
        'current_price' => 'setCurrentPrice',
        'current_proxy_bid' => 'setCurrentProxyBid',
        'high_bidder' => 'setHighBidder',
        'item_id' => 'setItemId',
        'reserve_price_met' => 'setReservePriceMet',
        'suggested_bid_amounts' => 'setSuggestedBidAmounts',
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests).
     *
     * @var string[]
     */
    protected static $getters = [
        'auction_end_date' => 'getAuctionEndDate',
        'auction_status' => 'getAuctionStatus',
        'bid_count' => 'getBidCount',
        'current_price' => 'getCurrentPrice',
        'current_proxy_bid' => 'getCurrentProxyBid',
        'high_bidder' => 'getHighBidder',
        'item_id' => 'getItemId',
        'reserve_price_met' => 'getReservePriceMet',
        'suggested_bid_amounts' => 'getSuggestedBidAmounts',
    ];

    /**
     * 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['auction_end_date'] = $data['auction_end_date'] ?? null;
        $this->container['auction_status'] = $data['auction_status'] ?? null;
        $this->container['bid_count'] = $data['bid_count'] ?? null;
        $this->container['current_price'] = $data['current_price'] ?? null;
        $this->container['current_proxy_bid'] = $data['current_proxy_bid'] ?? null;
        $this->container['high_bidder'] = $data['high_bidder'] ?? null;
        $this->container['item_id'] = $data['item_id'] ?? null;
        $this->container['reserve_price_met'] = $data['reserve_price_met'] ?? null;
        $this->container['suggested_bid_amounts'] = $data['suggested_bid_amounts'] ?? 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 auction_end_date.
     *
     * @return string|null
     */
    public function getAuctionEndDate()
    {
        return $this->container['auction_end_date'];
    }

    /**
     * Sets auction_end_date.
     *
     * @param string|null $auction_end_date the date the auction will end
     *
     * @return self
     */
    public function setAuctionEndDate($auction_end_date)
    {
        $this->container['auction_end_date'] = $auction_end_date;

        return $this;
    }

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

    /**
     * Sets auction_status.
     *
     * @param string|null $auction_status An enumeration value that represents the current state of the auction, such as ACTIVE or ENDED. If this value is ENDED and the value of highBidder is true, this indicates the buyer has won the auction. For implementation help, refer to <a href='https://developer.ebay.com/api-docs/buy/offer/types/api:AuctionStatusEnum'>eBay API documentation</a>
     *
     * @return self
     */
    public function setAuctionStatus($auction_status)
    {
        $this->container['auction_status'] = $auction_status;

        return $this;
    }

    /**
     * Gets bid_count.
     *
     * @return int|null
     */
    public function getBidCount()
    {
        return $this->container['bid_count'];
    }

    /**
     * Sets bid_count.
     *
     * @param int|null $bid_count the number of proxy bids that have been placed for the auction
     *
     * @return self
     */
    public function setBidCount($bid_count)
    {
        $this->container['bid_count'] = $bid_count;

        return $this;
    }

    /**
     * Gets current_price.
     *
     * @return \TNT\Ebay\Buy\OfferBeta\V1\Model\Amount|null
     */
    public function getCurrentPrice()
    {
        return $this->container['current_price'];
    }

    /**
     * Sets current_price.
     *
     * @param \TNT\Ebay\Buy\OfferBeta\V1\Model\Amount|null $current_price current_price
     *
     * @return self
     */
    public function setCurrentPrice($current_price)
    {
        $this->container['current_price'] = $current_price;

        return $this;
    }

    /**
     * Gets current_proxy_bid.
     *
     * @return \TNT\Ebay\Buy\OfferBeta\V1\Model\ProxyBid|null
     */
    public function getCurrentProxyBid()
    {
        return $this->container['current_proxy_bid'];
    }

    /**
     * Sets current_proxy_bid.
     *
     * @param \TNT\Ebay\Buy\OfferBeta\V1\Model\ProxyBid|null $current_proxy_bid current_proxy_bid
     *
     * @return self
     */
    public function setCurrentProxyBid($current_proxy_bid)
    {
        $this->container['current_proxy_bid'] = $current_proxy_bid;

        return $this;
    }

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

    /**
     * Sets high_bidder.
     *
     * @param bool|null $high_bidder Indicates if the buyer is the highest bidder. If the value is false, this indicates that either the buyer has not bid on this item or has been out-bid. If this value is true, this indicates the buyer is winning the auction and if the value of auctionStatus is ENDED, this indicates the buyer has won the auction.
     *
     * @return self
     */
    public function setHighBidder($high_bidder)
    {
        $this->container['high_bidder'] = $high_bidder;

        return $this;
    }

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

    /**
     * Sets item_id.
     *
     * @param string|null $item_id the eBay RESTful identifier of an item being bid on, which was submitted in the request
     *
     * @return self
     */
    public function setItemId($item_id)
    {
        $this->container['item_id'] = $item_id;

        return $this;
    }

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

    /**
     * Sets reserve_price_met.
     *
     * @param bool|null $reserve_price_met This indicates if the reserve price of the item has been met. A reserve price is set by the seller and is the minimum amount the seller is willing to sell the item for. If the highest bid is not equal to or higher than the reserve price when the auction ends, the listing ends and the item is not sold. Note: This is returned only for auctions that have a reserve price.
     *
     * @return self
     */
    public function setReservePriceMet($reserve_price_met)
    {
        $this->container['reserve_price_met'] = $reserve_price_met;

        return $this;
    }

    /**
     * Gets suggested_bid_amounts.
     *
     * @return \TNT\Ebay\Buy\OfferBeta\V1\Model\Amount[]|null
     */
    public function getSuggestedBidAmounts()
    {
        return $this->container['suggested_bid_amounts'];
    }

    /**
     * Sets suggested_bid_amounts.
     *
     * @param \TNT\Ebay\Buy\OfferBeta\V1\Model\Amount[]|null $suggested_bid_amounts The suggested bid amount for the next bid. Note: These are generated suggestions and do not guarantee the buyer will win the bid. This means these suggestions do not take into account the max bid amount of other bidders. The buyer can be outbid even if they submit the highest suggested bid.
     *
     * @return self
     */
    public function setSuggestedBidAmounts($suggested_bid_amounts)
    {
        $this->container['suggested_bid_amounts'] = $suggested_bid_amounts;

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