<?php

namespace auctionforge\inc\model;

use stdClass;
use auctionforge\inc\abs\Importer;
use auctionforge\inc\abs\Model;
use auctionforge\inc\controllers\BidspiritLots;
use auctionforge\inc\controllers\MultiLanguageSupport;
use auctionforge\inc\controllers\PolylangSupport;
use auctionforge\inc\Debug;
use auctionforge\inc\helpers\SettingsHelper;
use auctionforge\inc\InstanceDB;
use WP_Post;

class LotModel extends Model
{
    protected $lotId;
    protected $auctionSlug;
    protected $lang;
    protected $itemIndex;
    protected $paddedIndex;
    protected $name;
    protected $nameL2;
    protected $descriptionL2;
    protected $description;
    protected $author;
    protected $authorL2;
    protected $mlFields;
    protected $details;
    protected $startPrice;
    protected $leadingBid;
    protected $soldBid;
    protected $auctionId;
    protected $imagesListStr;
    protected $categoryId;
    protected $estimatedPrice;
    protected $tags;
    protected $videoUrl;
    protected $extraInfo;
    protected $postSaleDisabled;
    protected $imagesBase;
    protected $imagesCloned;
    protected $buyoutPrice;
    protected $lastUpdate;
    protected $fullPriceVat;
    protected $largeDisplay;
    protected $viewOnly;
    protected $hidden;
    protected $hiddenInPortal;
    protected $removedFromAuction;
    protected $eroticContent;
    protected $criminalContent;
    protected $isGem;
    protected $priority;
    protected $syncStart;
    protected $syncFinished;
    protected $syncDatetime;
    protected $syncErrors;
    protected $syncTimes;
    protected $createDatetime;
    protected $params;

    const STRING_MASK = "%s";
    const DIGIT_MASK = "%d";

    /**
     * @return mixed
     */
    public function getLang()
    {
        return $this->lang;
    }

    /**
     * @return void
     */
    public function setLang($lang)
    {
        $this->lang = $lang;
    }

    /**
     * @return mixed
     */
    public function getItemIndex()
    {
        return $this->itemIndex;
    }

    /**
     * @param mixed $itemIndex
     */
    public function setItemIndex($itemIndex)
    {
        $this->itemIndex = $itemIndex;
    }

    /**
     * @return mixed
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * @param mixed $description
     */
    public function setDescription($description)
    {
        $this->description = $description;
    }

    /**
     * @return mixed
     */
    public function getAuthor()
    {
        return $this->author;
    }

    /**
     * @param mixed $author
     */
    public function setAuthor($author)
    {
        $this->author = mb_substr($author, 0, 255);
    }

    /**
     * @return mixed
     */
    public function getDetails()
    {
        return $this->details;
    }

    /**
     * @param mixed $details
     */
    public function setDetails($details)
    {
        $this->details = $details;
    }

    /**
     * @return mixed
     */
    public function getStartPrice()
    {
        return $this->startPrice;
    }

    /**
     * @param mixed $startPrice
     */
    public function setStartPrice($startPrice)
    {
        $this->startPrice = $startPrice;
    }

    /**
     * @return mixed
     */
    public function getAuctionId()
    {
        return $this->auctionId;
    }

    /**
     * @param mixed $auctionId
     */
    public function setAuctionId($auctionId)
    {
        $this->auctionId = $auctionId;
    }

    /**
     * @return mixed
     */
    public function getImagesListStr()
    {
        return $this->imagesListStr;
    }

    /**
     * @param mixed $imagesListStr
     */
    public function setImagesListStr($imagesListStr)
    {
        $this->imagesListStr = $imagesListStr;
    }

    /**
     * @return mixed
     */
    public function getEstimatedPrice()
    {
        return $this->estimatedPrice;
    }

    /**
     * @param mixed $estimatedPrice
     */
    public function setEstimatedPrice($estimatedPrice)
    {
        $this->estimatedPrice = mb_substr($estimatedPrice, 0, 55);
    }

    /**
     * @return mixed
     */
    public function getTags()
    {
        return $this->tags;
    }

    /**
     * @param mixed $tags
     */
    public function setTags($tags)
    {
        $this->tags = mb_substr($tags, 0, 255);
    }

    /**
     * @return mixed
     */
    public function getVideoUrl()
    {
        return $this->videoUrl;
    }

    /**
     * @param mixed $videoUrl
     */
    public function setVideoUrl($videoUrl)
    {
        $this->videoUrl = mb_substr($videoUrl, 0, 255);
    }

    /**
     * @return mixed
     */
    public function getExtraInfo()
    {
        return $this->extraInfo;
    }

    /**
     * @param mixed $extraInfo
     */
    public function setExtraInfo($extraInfo)
    {
        $this->extraInfo = $extraInfo;
    }

    /**
     * @return mixed
     */
    public function getPostSaleDisabled()
    {
        return $this->postSaleDisabled;
    }

    /**
     * @param mixed $postSaleDisabled
     */
    public function setPostSaleDisabled($postSaleDisabled)
    {
        $this->postSaleDisabled = $postSaleDisabled;
    }

    /**
     * @return mixed
     */
    public function getImagesBase()
    {
        return $this->imagesBase;
    }

    /**
     * @param mixed $imagesBase
     */
    public function setImagesBase($imagesBase)
    {
        $this->imagesBase = mb_substr($imagesBase, 0, 255);
    }

    /**
     * @return mixed
     */
    public function getImagesCloned()
    {
        return $this->imagesCloned;
    }

    /**
     * @param mixed $imagesCloned
     */
    public function setImagesCloned($imagesCloned)
    {
        $this->imagesCloned = $imagesCloned;
    }

    /**
     * @return mixed
     */
    public function getBuyoutPrice()
    {
        return $this->buyoutPrice;
    }

    /**
     * @param mixed $buyoutPrice
     */
    public function setBuyoutPrice($buyoutPrice)
    {
        $this->buyoutPrice = $buyoutPrice;
    }

    /**
     * @return mixed
     */
    public function getLastUpdate()
    {
        return $this->lastUpdate;
    }

    /**
     * @param mixed $lastUpdate
     */
    public function setLastUpdate($lastUpdate)
    {
        $this->lastUpdate = $lastUpdate;
    }

    /**
     * @return mixed
     */
    public function getFullPriceVat()
    {
        return $this->fullPriceVat;
    }

    /**
     * @param mixed $fullPriceVat
     */
    public function setFullPriceVat($fullPriceVat)
    {
        $this->fullPriceVat = $fullPriceVat;
    }

    /**
     * @return mixed
     */
    public function getLargeDisplay()
    {
        return $this->largeDisplay;
    }

    /**
     * @param mixed $largeDisplay
     */
    public function setLargeDisplay($largeDisplay)
    {
        $this->largeDisplay = $largeDisplay;
    }

    /**
     * @return mixed
     */
    public function getViewOnly()
    {
        return $this->viewOnly;
    }

    /**
     * @param mixed $viewOnly
     */
    public function setViewOnly($viewOnly)
    {
        $this->viewOnly = $viewOnly;
    }

    /**
     * @return mixed
     */
    public function getHidden()
    {
        return $this->hidden;
    }

    /**
     * @param mixed $hidden
     */
    public function setHidden($hidden)
    {
        $this->hidden = $hidden;
    }

    /**
     * @return mixed
     */
    public function getHiddenInPortal()
    {
        return $this->hiddenInPortal;
    }

    /**
     * @param mixed $hiddenInPortal
     */
    public function setHiddenInPortal($hiddenInPortal)
    {
        $this->hiddenInPortal = $hiddenInPortal;
    }

    /**
     * @return mixed
     */
    public function getRemovedFromAuction()
    {
        return $this->removedFromAuction;
    }

    /**
     * @param mixed $removedFromAuction
     */
    public function setRemovedFromAuction($removedFromAuction)
    {
        $this->removedFromAuction = $removedFromAuction;
    }

    /**
     * @return mixed
     */
    public function getEroticContent()
    {
        return $this->eroticContent;
    }

    /**
     * @param mixed $eroticContent
     */
    public function setEroticContent($eroticContent)
    {
        $this->eroticContent = $eroticContent;
    }

    /**
     * @return mixed
     */
    public function getCriminalContent()
    {
        return $this->criminalContent;
    }

    /**
     * @param mixed $eroticContent
     */
    public function setCriminalContent($criminalContent)
    {
        $this->criminalContent = $criminalContent;
    }

    /**
     * @return mixed
     */
    public function getIsGem()
    {
        return $this->isGem;
    }

    /**
     * @param mixed $isGem
     */
    public function setIsGem($isGem)
    {
        $this->isGem = $isGem;
    }

    /**
     * @return mixed
     */
    public function getCategoryId()
    {
        return $this->categoryId;
    }

    /**
     * @param mixed $categoryId
     */
    public function setCategoryId($categoryId)
    {
        $this->categoryId = $categoryId;
    }

    /**
     * @return mixed
     */
    public function getSyncFinished()
    {
        return $this->syncFinished;
    }

    /**
     * @param mixed $syncFinished
     */
    public function setSyncFinished($syncFinished)
    {
        $this->syncFinished = $syncFinished;
    }

    /**
     * @return mixed
     */
    public function getAuctionSlug()
    {
        return $this->auctionSlug;
    }

    /**
     * @param mixed $auctionSlug
     */
    public function setAuctionSlug($auctionSlug)
    {
        $this->auctionSlug = mb_substr($auctionSlug, 0, 55);
    }

    /**
     * @return mixed
     */
    public function getSyncDatetime()
    {
        return $this->syncDatetime;
    }

    /**
     * @param mixed $syncDatetime
     */
    public function setSyncDatetime($syncDatetime)
    {
        $this->syncDatetime = $syncDatetime;
    }

    /**
     * @return mixed
     */
    public function getSyncErrors()
    {
        return $this->syncErrors;
    }

    /**
     * @param mixed $syncErrors
     */
    public function setSyncErrors($syncErrors)
    {
        $this->syncErrors = $syncErrors;
    }

    /**
     * @return mixed
     */
    public function getSyncTimes()
    {
        return $this->syncTimes;
    }

    /**
     * @param mixed $syncTimes
     */
    public function setSyncTimes($syncTimes)
    {
        $this->syncTimes = $syncTimes;
    }

    /**
     * @return mixed
     */
    public function getLotId()
    {
        return $this->lotId;
    }

    /**
     * @param mixed $lotId
     */
    public function setLotId($lotId)
    {
        $this->lotId = $lotId;
    }

    /**
     * @return mixed
     */
    public function getSyncStart()
    {
        return $this->syncStart;
    }

    /**
     * @param mixed $syncStart
     */
    public function setSyncStart($syncStart)
    {
        $this->syncStart = $syncStart;
    }

    /**
     * @return mixed
     */
    public function getCreateDatetime()
    {
        return $this->createDatetime;
    }

    /**
     * @param mixed $createDatetime
     */
    public function setCreateDatetime($createDatetime)
    {
        $this->createDatetime = $createDatetime;
    }

    /**
     * @return mixed
     */
    public function getPriority()
    {
        return $this->priority;
    }

    /**
     * @param mixed $priority
     */
    public function setPriority($priority)
    {
        $this->priority = $priority;
    }

    /**
     * @return mixed
     */
    public function getPaddedIndex()
    {
        return $this->paddedIndex;
    }

    /**
     * @param  mixed  $paddedIndex
     */
    public function setPaddedIndex($paddedIndex)
    {
        $this->paddedIndex = $paddedIndex;
    }

    /**
     * @return mixed
     */
    public function getLeadingBid()
    {
        return $this->leadingBid;
    }

    /**
     * @param  mixed  $leadingBid
     */
    public function setLeadingBid($leadingBid)
    {
        if (!empty($leadingBid->leadingBid)) {
            $this->leadingBid = $leadingBid->leadingBid->price;
        } elseif (is_object($leadingBid)) {
            $this->leadingBid = 0;
        } else {
            $this->leadingBid = $leadingBid;
        }
    }

    /**
     * @return mixed
     */
    public function getSoldBid()
    {
        return $this->soldBid;
    }

    /**
     * @param  mixed  $soldBid
     */
    public function setSoldBid($soldBid)
    {
        if (is_object($soldBid) && !empty($soldBid->soldBid)) {
            $this->soldBid = $soldBid->soldBid->price;
        } elseif (is_object($soldBid) && !isset($soldBid->soldBid)) {
            $this->soldBid = 0;
        } else {
            $this->soldBid = $soldBid;
        }
    }

    /**
     * @return mixed
     */
    public function getNameL2()
    {
        return $this->nameL2;
    }

    /**
     * @param  mixed  $nameL2
     */
    public function setNameL2($nameL2)
    {
        $this->nameL2 = mb_substr($nameL2, 0, 255);
    }

    /**
     * @return mixed
     */
    public function getDescriptionL2()
    {
        return $this->descriptionL2;
    }

    /**
     * @param  mixed  $descriptionL2
     */
    public function setDescriptionL2($descriptionL2)
    {
        $this->descriptionL2 = $descriptionL2;
    }

    /**
     * @return mixed
     */
    public function getAuthorL2()
    {
        return $this->authorL2;
    }

    /**
     * @param  mixed  $authorL2
     */
    public function setAuthorL2($authorL2)
    {
        $this->authorL2 = mb_substr($authorL2, 0, 255);
    }

    /**
     * @return mixed
     */
    public function getMlFields()
    {
        return $this->mlFields;
    }

    /**
     * @param  mixed  $mlFields
     */
    public function setMlFields($mlFields)
    {
        $this->mlFields = $mlFields;
    }

    /**
     * @return mixed
     */
    public function getParams()
    {
        return $this->params;
    }

    /**
     * @param  mixed  $params
     */
    public function setParams($params)
    {
        $this->params = $params;
    }
}