<?php

namespace ebay\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for OfferType StructType
 * Meta informations extracted from the WSDL
 * - documentation: Contains information pertaining to an offer made on an item listing and the current bidding or purchase state of the listing.
 * @subpackage Structs
 * @date 2017-04-07 16
 */
class OfferType extends AbstractStructBase
{
    /**
     * The Action
     * Meta informations extracted from the WSDL
     * - documentation: Indicates the type of offer being made on the specified listing. If the item is Best Offer enabled and the buyer makes a Best Offer (or a counter offer), then after the <b>PlaceOffer</b> call, the buyer can get the status of the Best
     * Offer (and of a possible seller-counter-offer, etc.) using the <b>GetBestOffers</b> call. See the <a href="http://developer.ebay.com/DevZone/guides/ebayfeatures/Development/Feature-BestOffer.html">eBay Features Guide</a> for information about
     * best-offer enabled items and about <b>GetBestOffers</b>.
     * - minOccurs: 0
     * @var string
     */
    public $Action;
    /**
     * The Currency
     * Meta informations extracted from the WSDL
     * - documentation: Three-digit currency code for the currency used for the auction. Valid values can be viewed in the <b>CurrencyCodeType</b> code list.
     * - minOccurs: 0
     * @var string
     */
    public $Currency;
    /**
     * The ItemID
     * Meta informations extracted from the WSDL
     * - documentation: The unique identifier of an item listed on the eBay site. Returned by eBay when the item is created. | Type that represents the unique identifier for a single item listing.
     * - minOccurs: 0
     * @var string
     */
    public $ItemID;
    /**
     * The MaxBid
     * Meta informations extracted from the WSDL
     * - documentation: Amount of the offer placed. For auction listings, the amount bid on the item (subject to outbid by other buyers). For fixed-price listings, the fixed sale price at which the item is purchased. For auction listings with an active Buy
     * It Now option, this amount will be either the Buy It Now price for purchase or the amount of a bid, depending on the offer type (as specified in <b>Action</b>). For <b>PlaceOffer</b>, the <b>CurrencyID</b> attribute is ignored if provided. Regarding
     * Value-Added Tax (VAT): Even if VAT applies, you do not need to add VAT to the <b>MaxBid</b> value. If VAT applies to the listing, the seller can specify a VAT percent value when they list the item.
     * - minOccurs: 0
     * @var \ebay\StructType\AmountType
     */
    public $MaxBid;
    /**
     * The Quantity
     * Meta informations extracted from the WSDL
     * - documentation: Specifies the number of items from the specified listing the user tendering the offer intends to purchase, bid on, or make a Best Offer on. For auctions, the value may not exceed one. For multi-item listings, must be greater than
     * zero and not exceeding the number of items offered for sale in the listing.
     * - minOccurs: 0
     * @var int
     */
    public $Quantity;
    /**
     * The SecondChanceEnabled
     * Meta informations extracted from the WSDL
     * - documentation: Indicates the user's preference to accept second chance offers. If <code>true</code>, the user is willing to be the recipient of second chance offers.
     * - minOccurs: 0
     * @var bool
     */
    public $SecondChanceEnabled;
    /**
     * The SiteCurrency
     * Meta informations extracted from the WSDL
     * - documentation: Unique ID identifying the currency in which the localized offer amounts are expressed.
     * - minOccurs: 0
     * @var string
     */
    public $SiteCurrency;
    /**
     * The TimeBid
     * Meta informations extracted from the WSDL
     * - documentation: Date and time the offer or bid was placed.
     * - minOccurs: 0
     * @var string
     */
    public $TimeBid;
    /**
     * The HighestBid
     * Meta informations extracted from the WSDL
     * - documentation: Amount the highest bidder has bid on the item. Applicable to only auction listings where there is progressive bidding and winning bidders are determined based on the highest bid.
     * - minOccurs: 0
     * @var \ebay\StructType\AmountType
     */
    public $HighestBid;
    /**
     * The ConvertedPrice
     * Meta informations extracted from the WSDL
     * - documentation: Localized amount for the item's current price.
     * - minOccurs: 0
     * @var \ebay\StructType\AmountType
     */
    public $ConvertedPrice;
    /**
     * The TransactionID
     * Meta informations extracted from the WSDL
     * - documentation: The unique identifier of the order line item (transaction). An order line item is created when a winning bidder commits to purchasing an item.
     * - minOccurs: 0
     * @var string
     */
    public $TransactionID;
    /**
     * The User
     * Meta informations extracted from the WSDL
     * - documentation: Bidder information. See the schema documentation for <b>UserType</b> for details on its properties and their meanings.
     * - minOccurs: 0
     * @var \ebay\StructType\UserType
     */
    public $User;
    /**
     * The UserConsent
     * Meta informations extracted from the WSDL
     * - documentation: If <code>true</code>, confirms that the bidder read and agrees to eBay's privacy policy. Applies if the subject item is in a category that requires user consent. If user consent, which is confirmation that a bidder read and agrees to
     * eBay's privacy policy, is required for a category that the subject item is in, this value must be <code>true</code> for a bid to occur.
     * - minOccurs: 0
     * @var bool
     */
    public $UserConsent;
    /**
     * The BidCount
     * Meta informations extracted from the WSDL
     * - documentation: This field is deprecated.
     * - minOccurs: 0
     * @var int
     */
    public $BidCount;
    /**
     * The Message
     * Meta informations extracted from the WSDL
     * - documentation: A message from the buyer to the seller. Applies if the buyer is using <b>PlaceOffer</b> to perform a best-offer-related action (Best Offer, counter offer, etc.).
     * - minOccurs: 0
     * @var string
     */
    public $Message;
    /**
     * The BestOfferID
     * Meta informations extracted from the WSDL
     * - documentation: The ID of a Best Offer on an item. Must be specified as input to <b>PlaceOffer</b> only if a buyer is accepting or declining a seller's counter offer (and is not required for a buyer's offer or counter offer). | Unique identifier for
     * a Best Offer. This identifier is created once a prospective buyer makes a Best Offer on an item.
     * - minOccurs: 0
     * @var string
     */
    public $BestOfferID;
    /**
     * The MyMaxBid
     * Meta informations extracted from the WSDL
     * - documentation: Maximum bid placed by the user making the call.
     * - minOccurs: 0
     * @var \ebay\StructType\AmountType
     */
    public $MyMaxBid;
    /**
     * The any
     * @var \DOMDocument
     */
    public $any;
    /**
     * Constructor method for OfferType
     * @uses OfferType::setAction()
     * @uses OfferType::setCurrency()
     * @uses OfferType::setItemID()
     * @uses OfferType::setMaxBid()
     * @uses OfferType::setQuantity()
     * @uses OfferType::setSecondChanceEnabled()
     * @uses OfferType::setSiteCurrency()
     * @uses OfferType::setTimeBid()
     * @uses OfferType::setHighestBid()
     * @uses OfferType::setConvertedPrice()
     * @uses OfferType::setTransactionID()
     * @uses OfferType::setUser()
     * @uses OfferType::setUserConsent()
     * @uses OfferType::setBidCount()
     * @uses OfferType::setMessage()
     * @uses OfferType::setBestOfferID()
     * @uses OfferType::setMyMaxBid()
     * @uses OfferType::setAny()
     * @param string $action
     * @param string $currency
     * @param string $itemID
     * @param \ebay\StructType\AmountType $maxBid
     * @param int $quantity
     * @param bool $secondChanceEnabled
     * @param string $siteCurrency
     * @param string $timeBid
     * @param \ebay\StructType\AmountType $highestBid
     * @param \ebay\StructType\AmountType $convertedPrice
     * @param string $transactionID
     * @param \ebay\StructType\UserType $user
     * @param bool $userConsent
     * @param int $bidCount
     * @param string $message
     * @param string $bestOfferID
     * @param \ebay\StructType\AmountType $myMaxBid
     * @param \DOMDocument $any
     */
    public function __construct($action = null, $currency = null, $itemID = null, \ebay\StructType\AmountType $maxBid = null, $quantity = null, $secondChanceEnabled = null, $siteCurrency = null, $timeBid = null, \ebay\StructType\AmountType $highestBid = null, \ebay\StructType\AmountType $convertedPrice = null, $transactionID = null, \ebay\StructType\UserType $user = null, $userConsent = null, $bidCount = null, $message = null, $bestOfferID = null, \ebay\StructType\AmountType $myMaxBid = null, \DOMDocument $any = null)
    {
        $this
            ->setAction($action)
            ->setCurrency($currency)
            ->setItemID($itemID)
            ->setMaxBid($maxBid)
            ->setQuantity($quantity)
            ->setSecondChanceEnabled($secondChanceEnabled)
            ->setSiteCurrency($siteCurrency)
            ->setTimeBid($timeBid)
            ->setHighestBid($highestBid)
            ->setConvertedPrice($convertedPrice)
            ->setTransactionID($transactionID)
            ->setUser($user)
            ->setUserConsent($userConsent)
            ->setBidCount($bidCount)
            ->setMessage($message)
            ->setBestOfferID($bestOfferID)
            ->setMyMaxBid($myMaxBid)
            ->setAny($any);
    }
    /**
     * Get Action value
     * @return string|null
     */
    public function getAction()
    {
        return $this->Action;
    }
    /**
     * Set Action value
     * @uses \ebay\EnumType\BidActionCodeType::valueIsValid()
     * @uses \ebay\EnumType\BidActionCodeType::getValidValues()
     * @throws \InvalidArgumentException
     * @param string $action
     * @return \ebay\StructType\OfferType
     */
    public function setAction($action = null)
    {
        // validation for constraint: enumeration
        if (!\ebay\EnumType\BidActionCodeType::valueIsValid($action)) {
            throw new \InvalidArgumentException(sprintf('Value "%s" is invalid, please use one of: %s', $action, implode(', ', \ebay\EnumType\BidActionCodeType::getValidValues())), __LINE__);
        }
        $this->Action = $action;
        return $this;
    }
    /**
     * Get Currency value
     * @return string|null
     */
    public function getCurrency()
    {
        return $this->Currency;
    }
    /**
     * Set Currency value
     * @uses \ebay\EnumType\CurrencyCodeType::valueIsValid()
     * @uses \ebay\EnumType\CurrencyCodeType::getValidValues()
     * @throws \InvalidArgumentException
     * @param string $currency
     * @return \ebay\StructType\OfferType
     */
    public function setCurrency($currency = null)
    {
        // validation for constraint: enumeration
        if (!\ebay\EnumType\CurrencyCodeType::valueIsValid($currency)) {
            throw new \InvalidArgumentException(sprintf('Value "%s" is invalid, please use one of: %s', $currency, implode(', ', \ebay\EnumType\CurrencyCodeType::getValidValues())), __LINE__);
        }
        $this->Currency = $currency;
        return $this;
    }
    /**
     * Get ItemID value
     * @return string|null
     */
    public function getItemID()
    {
        return $this->ItemID;
    }
    /**
     * Set ItemID value
     * @param string $itemID
     * @return \ebay\StructType\OfferType
     */
    public function setItemID($itemID = null)
    {
        // validation for constraint: string
        if (!is_null($itemID) && !is_string($itemID)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($itemID)), __LINE__);
        }
        $this->ItemID = $itemID;
        return $this;
    }
    /**
     * Get MaxBid value
     * @return \ebay\StructType\AmountType|null
     */
    public function getMaxBid()
    {
        return $this->MaxBid;
    }
    /**
     * Set MaxBid value
     * @param \ebay\StructType\AmountType $maxBid
     * @return \ebay\StructType\OfferType
     */
    public function setMaxBid(\ebay\StructType\AmountType $maxBid = null)
    {
        $this->MaxBid = $maxBid;
        return $this;
    }
    /**
     * Get Quantity value
     * @return int|null
     */
    public function getQuantity()
    {
        return $this->Quantity;
    }
    /**
     * Set Quantity value
     * @param int $quantity
     * @return \ebay\StructType\OfferType
     */
    public function setQuantity($quantity = null)
    {
        // validation for constraint: int
        if (!is_null($quantity) && !is_numeric($quantity)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a numeric value, "%s" given', gettype($quantity)), __LINE__);
        }
        $this->Quantity = $quantity;
        return $this;
    }
    /**
     * Get SecondChanceEnabled value
     * @return bool|null
     */
    public function getSecondChanceEnabled()
    {
        return $this->SecondChanceEnabled;
    }
    /**
     * Set SecondChanceEnabled value
     * @param bool $secondChanceEnabled
     * @return \ebay\StructType\OfferType
     */
    public function setSecondChanceEnabled($secondChanceEnabled = null)
    {
        $this->SecondChanceEnabled = $secondChanceEnabled;
        return $this;
    }
    /**
     * Get SiteCurrency value
     * @return string|null
     */
    public function getSiteCurrency()
    {
        return $this->SiteCurrency;
    }
    /**
     * Set SiteCurrency value
     * @uses \ebay\EnumType\CurrencyCodeType::valueIsValid()
     * @uses \ebay\EnumType\CurrencyCodeType::getValidValues()
     * @throws \InvalidArgumentException
     * @param string $siteCurrency
     * @return \ebay\StructType\OfferType
     */
    public function setSiteCurrency($siteCurrency = null)
    {
        // validation for constraint: enumeration
        if (!\ebay\EnumType\CurrencyCodeType::valueIsValid($siteCurrency)) {
            throw new \InvalidArgumentException(sprintf('Value "%s" is invalid, please use one of: %s', $siteCurrency, implode(', ', \ebay\EnumType\CurrencyCodeType::getValidValues())), __LINE__);
        }
        $this->SiteCurrency = $siteCurrency;
        return $this;
    }
    /**
     * Get TimeBid value
     * @return string|null
     */
    public function getTimeBid()
    {
        return $this->TimeBid;
    }
    /**
     * Set TimeBid value
     * @param string $timeBid
     * @return \ebay\StructType\OfferType
     */
    public function setTimeBid($timeBid = null)
    {
        // validation for constraint: string
        if (!is_null($timeBid) && !is_string($timeBid)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($timeBid)), __LINE__);
        }
        $this->TimeBid = $timeBid;
        return $this;
    }
    /**
     * Get HighestBid value
     * @return \ebay\StructType\AmountType|null
     */
    public function getHighestBid()
    {
        return $this->HighestBid;
    }
    /**
     * Set HighestBid value
     * @param \ebay\StructType\AmountType $highestBid
     * @return \ebay\StructType\OfferType
     */
    public function setHighestBid(\ebay\StructType\AmountType $highestBid = null)
    {
        $this->HighestBid = $highestBid;
        return $this;
    }
    /**
     * Get ConvertedPrice value
     * @return \ebay\StructType\AmountType|null
     */
    public function getConvertedPrice()
    {
        return $this->ConvertedPrice;
    }
    /**
     * Set ConvertedPrice value
     * @param \ebay\StructType\AmountType $convertedPrice
     * @return \ebay\StructType\OfferType
     */
    public function setConvertedPrice(\ebay\StructType\AmountType $convertedPrice = null)
    {
        $this->ConvertedPrice = $convertedPrice;
        return $this;
    }
    /**
     * Get TransactionID value
     * @return string|null
     */
    public function getTransactionID()
    {
        return $this->TransactionID;
    }
    /**
     * Set TransactionID value
     * @param string $transactionID
     * @return \ebay\StructType\OfferType
     */
    public function setTransactionID($transactionID = null)
    {
        // validation for constraint: string
        if (!is_null($transactionID) && !is_string($transactionID)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($transactionID)), __LINE__);
        }
        $this->TransactionID = $transactionID;
        return $this;
    }
    /**
     * Get User value
     * @return \ebay\StructType\UserType|null
     */
    public function getUser()
    {
        return $this->User;
    }
    /**
     * Set User value
     * @param \ebay\StructType\UserType $user
     * @return \ebay\StructType\OfferType
     */
    public function setUser(\ebay\StructType\UserType $user = null)
    {
        $this->User = $user;
        return $this;
    }
    /**
     * Get UserConsent value
     * @return bool|null
     */
    public function getUserConsent()
    {
        return $this->UserConsent;
    }
    /**
     * Set UserConsent value
     * @param bool $userConsent
     * @return \ebay\StructType\OfferType
     */
    public function setUserConsent($userConsent = null)
    {
        $this->UserConsent = $userConsent;
        return $this;
    }
    /**
     * Get BidCount value
     * @return int|null
     */
    public function getBidCount()
    {
        return $this->BidCount;
    }
    /**
     * Set BidCount value
     * @param int $bidCount
     * @return \ebay\StructType\OfferType
     */
    public function setBidCount($bidCount = null)
    {
        // validation for constraint: int
        if (!is_null($bidCount) && !is_numeric($bidCount)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a numeric value, "%s" given', gettype($bidCount)), __LINE__);
        }
        $this->BidCount = $bidCount;
        return $this;
    }
    /**
     * Get Message value
     * @return string|null
     */
    public function getMessage()
    {
        return $this->Message;
    }
    /**
     * Set Message value
     * @param string $message
     * @return \ebay\StructType\OfferType
     */
    public function setMessage($message = null)
    {
        // validation for constraint: string
        if (!is_null($message) && !is_string($message)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($message)), __LINE__);
        }
        $this->Message = $message;
        return $this;
    }
    /**
     * Get BestOfferID value
     * @return string|null
     */
    public function getBestOfferID()
    {
        return $this->BestOfferID;
    }
    /**
     * Set BestOfferID value
     * @param string $bestOfferID
     * @return \ebay\StructType\OfferType
     */
    public function setBestOfferID($bestOfferID = null)
    {
        // validation for constraint: string
        if (!is_null($bestOfferID) && !is_string($bestOfferID)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($bestOfferID)), __LINE__);
        }
        $this->BestOfferID = $bestOfferID;
        return $this;
    }
    /**
     * Get MyMaxBid value
     * @return \ebay\StructType\AmountType|null
     */
    public function getMyMaxBid()
    {
        return $this->MyMaxBid;
    }
    /**
     * Set MyMaxBid value
     * @param \ebay\StructType\AmountType $myMaxBid
     * @return \ebay\StructType\OfferType
     */
    public function setMyMaxBid(\ebay\StructType\AmountType $myMaxBid = null)
    {
        $this->MyMaxBid = $myMaxBid;
        return $this;
    }
    /**
     * Get any value
     * @uses \DOMDocument::loadXML()
     * @uses \DOMDocument::hasChildNodes()
     * @uses \DOMDocument::saveXML()
     * @uses \DOMNode::item()
     * @uses \ebay\StructType\OfferType::setAny()
     * @param bool $asString true: returns XML string, false: returns \DOMDocument
     * @return \DOMDocument|null
     */
    public function getAny($asString = true)
    {
        if (!empty($this->any) && !($this->any instanceof \DOMDocument)) {
            $dom = new \DOMDocument('1.0', 'UTF-8');
            $dom->formatOutput = true;
            if ($dom->loadXML($this->any)) {
                $this->setAny($dom);
            }
            unset($dom);
        }
        return ($asString && ($this->any instanceof \DOMDocument) && $this->any->hasChildNodes()) ? $this->any->saveXML($this->any->childNodes->item(0)) : $this->any;
    }
    /**
     * Set any value
     * @param \DOMDocument $any
     * @return \ebay\StructType\OfferType
     */
    public function setAny(\DOMDocument $any = null)
    {
        $this->any = $any;
        return $this;
    }
    /**
     * Method called when an object has been exported with var_export() functions
     * It allows to return an object instantiated with the values
     * @see AbstractStructBase::__set_state()
     * @uses AbstractStructBase::__set_state()
     * @param array $array the exported values
     * @return \ebay\StructType\OfferType
     */
    public static function __set_state(array $array)
    {
        return parent::__set_state($array);
    }
    /**
     * Method returning the class name
     * @return string __CLASS__
     */
    public function __toString()
    {
        return __CLASS__;
    }
}
