brandon14/ebay-sdk-php

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

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

/**
 * Deal 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 />This API allows third-party developers to search for and retrieve details about eBay deals and events, as well as the items associated with those deals and events.
 *
 * The version of the OpenAPI document: v1.3.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\Buy\Deal\V1\Model;

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

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

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

    /**
     * Array of property to type mappings. Used for (de)serialization.
     *
     * @var string[]
     */
    protected static $openAPITypes = [
        'applicable_coupons' => '\TNT\Ebay\Buy\Deal\V1\Model\Coupon[]',
        'description' => 'string',
        'end_date' => 'string',
        'event_affiliate_web_url' => 'string',
        'event_id' => 'string',
        'event_web_url' => 'string',
        'images' => '\TNT\Ebay\Buy\Deal\V1\Model\Image[]',
        'start_date' => 'string',
        'terms' => '\TNT\Ebay\Buy\Deal\V1\Model\Terms',
        'title' => '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 = [
        'applicable_coupons' => null,
        'description' => null,
        'end_date' => null,
        'event_affiliate_web_url' => null,
        'event_id' => null,
        'event_web_url' => null,
        'images' => null,
        'start_date' => null,
        'terms' => null,
        'title' => 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 = [
        'applicable_coupons' => 'applicableCoupons',
        'description' => 'description',
        'end_date' => 'endDate',
        'event_affiliate_web_url' => 'eventAffiliateWebUrl',
        'event_id' => 'eventId',
        'event_web_url' => 'eventWebUrl',
        'images' => 'images',
        'start_date' => 'startDate',
        'terms' => 'terms',
        'title' => 'title',
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses).
     *
     * @var string[]
     */
    protected static $setters = [
        'applicable_coupons' => 'setApplicableCoupons',
        'description' => 'setDescription',
        'end_date' => 'setEndDate',
        'event_affiliate_web_url' => 'setEventAffiliateWebUrl',
        'event_id' => 'setEventId',
        'event_web_url' => 'setEventWebUrl',
        'images' => 'setImages',
        'start_date' => 'setStartDate',
        'terms' => 'setTerms',
        'title' => 'setTitle',
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests).
     *
     * @var string[]
     */
    protected static $getters = [
        'applicable_coupons' => 'getApplicableCoupons',
        'description' => 'getDescription',
        'end_date' => 'getEndDate',
        'event_affiliate_web_url' => 'getEventAffiliateWebUrl',
        'event_id' => 'getEventId',
        'event_web_url' => 'getEventWebUrl',
        'images' => 'getImages',
        'start_date' => 'getStartDate',
        'terms' => 'getTerms',
        'title' => 'getTitle',
    ];

    /**
     * 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['applicable_coupons'] = $data['applicable_coupons'] ?? null;
        $this->container['description'] = $data['description'] ?? null;
        $this->container['end_date'] = $data['end_date'] ?? null;
        $this->container['event_affiliate_web_url'] = $data['event_affiliate_web_url'] ?? null;
        $this->container['event_id'] = $data['event_id'] ?? null;
        $this->container['event_web_url'] = $data['event_web_url'] ?? null;
        $this->container['images'] = $data['images'] ?? null;
        $this->container['start_date'] = $data['start_date'] ?? null;
        $this->container['terms'] = $data['terms'] ?? null;
        $this->container['title'] = $data['title'] ?? 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 applicable_coupons.
     *
     * @return \TNT\Ebay\Buy\Deal\V1\Model\Coupon[]|null
     */
    public function getApplicableCoupons()
    {
        return $this->container['applicable_coupons'];
    }

    /**
     * Sets applicable_coupons.
     *
     * @param \TNT\Ebay\Buy\Deal\V1\Model\Coupon[]|null $applicable_coupons a list of coupons associated with the event
     *
     * @return self
     */
    public function setApplicableCoupons($applicable_coupons)
    {
        $this->container['applicable_coupons'] = $applicable_coupons;

        return $this;
    }

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

    /**
     * Sets description.
     *
     * @param string|null $description the event description
     *
     * @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 end date for the event
     *
     * @return self
     */
    public function setEndDate($end_date)
    {
        $this->container['end_date'] = $end_date;

        return $this;
    }

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

    /**
     * Sets event_affiliate_web_url.
     *
     * @param string|null $event_affiliate_web_url the URL of the View Event page for the event, which includes the affiliate tracking ID
     *
     * @return self
     */
    public function setEventAffiliateWebUrl($event_affiliate_web_url)
    {
        $this->container['event_affiliate_web_url'] = $event_affiliate_web_url;

        return $this;
    }

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

    /**
     * Sets event_id.
     *
     * @param string|null $event_id the unique identifier for the event
     *
     * @return self
     */
    public function setEventId($event_id)
    {
        $this->container['event_id'] = $event_id;

        return $this;
    }

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

    /**
     * Sets event_web_url.
     *
     * @param string|null $event_web_url the web URL for the event
     *
     * @return self
     */
    public function setEventWebUrl($event_web_url)
    {
        $this->container['event_web_url'] = $event_web_url;

        return $this;
    }

    /**
     * Gets images.
     *
     * @return \TNT\Ebay\Buy\Deal\V1\Model\Image[]|null
     */
    public function getImages()
    {
        return $this->container['images'];
    }

    /**
     * Sets images.
     *
     * @param \TNT\Ebay\Buy\Deal\V1\Model\Image[]|null $images the images for the event
     *
     * @return self
     */
    public function setImages($images)
    {
        $this->container['images'] = $images;

        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 start date for the event
     *
     * @return self
     */
    public function setStartDate($start_date)
    {
        $this->container['start_date'] = $start_date;

        return $this;
    }

    /**
     * Gets terms.
     *
     * @return \TNT\Ebay\Buy\Deal\V1\Model\Terms|null
     */
    public function getTerms()
    {
        return $this->container['terms'];
    }

    /**
     * Sets terms.
     *
     * @param \TNT\Ebay\Buy\Deal\V1\Model\Terms|null $terms terms
     *
     * @return self
     */
    public function setTerms($terms)
    {
        $this->container['terms'] = $terms;

        return $this;
    }

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

    /**
     * Sets title.
     *
     * @param string|null $title the title of the event
     *
     * @return self
     */
    public function setTitle($title)
    {
        $this->container['title'] = $title;

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