<?php

namespace KupShop\OrderingBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use KupShop\UserBundle\Entity\User;

/**
 * Orders.
 *
 * @ORM\Table(name="orders",
 *     uniqueConstraints={@ORM\UniqueConstraint(name="order_no", columns={"order_no"})},
 *     indexes={
 *
 *          @ORM\Index(name="date_updated", columns={"date_updated"}),
 *          @ORM\Index(name="status", columns={"status"}),
 *          @ORM\Index(name="id_user", columns={"id_user"}),
 *          @ORM\Index(name="delivery_type", columns={"delivery_type"}),
 *          @ORM\Index(name="id_delivery", columns={"id_delivery"}),
 * })
 *
 * @ORM\Entity(repositoryClass="KupShop\OrderingBundle\Repository\OrderRepository")
 */
//          @ORM\Index(name="flags", columns={"flags"}),
class Order
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer", options={"unsigned"=true})
     *
     * @ORM\Id
     *
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * Order Items.
     *
     * @ORM\OneToMany(targetEntity="OrderItem", mappedBy="idOrder")
     */
    private $items;

    /**
     * @var string
     *
     * @ORM\Column(name="order_no", type="string", length=20, nullable=false)
     */
    private $orderNo = '';

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date_created", type="datetime", nullable=true)
     */
    private $dateCreated;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date_accept", type="datetime", nullable=true)
     */
    private $dateAccept;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date_handle", type="datetime", nullable=true)
     */
    private $dateHandle;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date_updated", type="datetime", nullable=true)
     */
    private $dateUpdated;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date_delivered", type="datetime", nullable=true)
     */
    private $dateDelivered;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date_due", type="datetime", nullable=true)
     */
    private $dateDue;

    /**
     * @var bool
     *
     * @ORM\Column(name="status", type="boolean", nullable=false)
     */
    private $status = '1';

    /**
     * @var bool
     *
     * @ORM\Column(name="status_payed", type="boolean", nullable=false)
     */
    private $statusPayed = '0';

    /**
     * @var bool
     *
     * @ORM\Column(name="status_dispatch", type="boolean", nullable=false)
     */
    private $statusDispatch = '0';

    /**
     * @var bool
     *
     * @ORM\Column(name="status_storno", type="boolean", nullable=false)
     */
    private $statusStorno = '0';

    /**
     * @var string
     *
     * @ORM\Column(name="total_price", type="decimal", precision=15, scale=4, nullable=false)
     */
    private $totalPrice = '0.0000';

    /**
     * @var string
     *
     * @ORM\Column(name="invoice_name", type="string", length=20, nullable=false)
     */
    private $invoiceName = '';

    /**
     * @var string
     *
     * @ORM\Column(name="invoice_surname", type="string", length=50, nullable=false)
     */
    private $invoiceSurname = '';

    /**
     * @var string
     *
     * @ORM\Column(name="invoice_firm", type="string", length=100, nullable=false)
     */
    private $invoiceFirm = '';

    /**
     * @var string
     *
     * @ORM\Column(name="invoice_ico", type="string", length=12, nullable=false)
     */
    private $invoiceIco = '';

    /**
     * @var string
     *
     * @ORM\Column(name="invoice_dic", type="string", length=15, nullable=false)
     */
    private $invoiceDic = '';

    /**
     * @var string
     *
     * @ORM\Column(name="invoice_street", type="string", length=100, nullable=false)
     */
    private $invoiceStreet = '';

    /**
     * @var string
     *
     * @ORM\Column(name="invoice_city", type="string", length=50, nullable=false)
     */
    private $invoiceCity = '';

    /**
     * @var string
     *
     * @ORM\Column(name="invoice_zip", type="string", length=5, nullable=false)
     */
    private $invoiceZip = '';

    /**
     * @var string
     *
     * @ORM\Column(name="invoice_country", type="string", length=50, nullable=false)
     */
    private $invoiceCountry = '';

    /**
     * @var string
     *
     * @ORM\Column(name="invoice_phone", type="string", length=20, nullable=false)
     */
    private $invoicePhone = '';

    /**
     * @var string
     *
     * @ORM\Column(name="invoice_email", type="string", length=50, nullable=false)
     */
    private $invoiceEmail = '';

    /**
     * @var string
     *
     * @ORM\Column(name="delivery_name", type="string", length=20, nullable=false)
     */
    private $deliveryName = '';

    /**
     * @var string
     *
     * @ORM\Column(name="delivery_surname", type="string", length=50, nullable=false)
     */
    private $deliverySurname = '';

    /**
     * @var string
     *
     * @ORM\Column(name="delivery_firm", type="string", length=100, nullable=false)
     */
    private $deliveryFirm = '';

    /**
     * @var string
     *
     * @ORM\Column(name="delivery_street", type="string", length=100, nullable=false)
     */
    private $deliveryStreet = '';

    /**
     * @var string
     *
     * @ORM\Column(name="delivery_city", type="string", length=50, nullable=false)
     */
    private $deliveryCity = '';

    /**
     * @var string
     *
     * @ORM\Column(name="delivery_zip", type="string", length=5, nullable=false)
     */
    private $deliveryZip = '';

    /**
     * @var string
     *
     * @ORM\Column(name="delivery_country", type="string", length=50, nullable=false)
     */
    private $deliveryCountry = '';

    /**
     * @var string
     *
     * @ORM\Column(name="delivery_type", type="string", length=200, nullable=false)
     */
    private $deliveryType;

    /**
     * @var string
     *
     * @ORM\Column(name="delivery_complete", type="string", nullable=false)
     */
    private $deliveryComplete = 'N';

    /**
     * @var string
     *
     * @ORM\Column(name="note_user", type="text", length=16777215, nullable=true)
     */
    private $noteUser;

    /**
     * @var string
     *
     * @ORM\Column(name="user_order_no", type="text", length=16777215, nullable=true)
     */
    private $userOrderNo;

    /**
     * @var string
     *
     * @ORM\Column(name="note_admin", type="text", length=16777215, nullable=true)
     */
    private $noteAdmin;

    /**
     * @var array
     *
     * @ORM\Column(name="flags", type="simple_array", nullable=false)
     */
    //    private $flags;

    /**
     * @var User
     *
     * @ORM\ManyToOne(targetEntity="KupShop\UserBundle\Entity\User")
     *
     * @ORM\JoinColumns({
     *
     *   @ORM\JoinColumn(name="id_user", referencedColumnName="id")
     * })
     */
    private $idUser;

    /**
     * @var DeliveryType
     *
     * @ORM\ManyToOne(targetEntity="KupShop\OrderingBundle\Entity\DeliveryType")
     *
     * @ORM\JoinColumns({
     *
     *   @ORM\JoinColumn(name="id_delivery", referencedColumnName="id")
     * })
     */
    private $idDelivery;

    public function getIdDelivery(): ?DeliveryType
    {
        return $this->idDelivery;
    }

    public function setIdDelivery(DeliveryType $idDelivery)
    {
        $this->idDelivery = $idDelivery;
    }

    /**
     * @return \Order
     */
    public function getKupshopOrder()
    {
        $order = new \Order();
        $order->createFromDB($this->getId());

        return $order;
    }

    /**
     * Get id.
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set orderNo.
     *
     * @param string $orderNo
     *
     * @return Order
     */
    public function setOrderNo($orderNo)
    {
        $this->orderNo = $orderNo;

        return $this;
    }

    /**
     * Get orderNo.
     *
     * @return string
     */
    public function getOrderNo()
    {
        return $this->orderNo;
    }

    /**
     * Set dateCreated.
     *
     * @param \DateTime $dateCreated
     *
     * @return Order
     */
    public function setDateCreated($dateCreated)
    {
        $this->dateCreated = $dateCreated;

        return $this;
    }

    /**
     * Get dateCreated.
     *
     * @return \DateTime
     */
    public function getDateCreated()
    {
        return $this->dateCreated;
    }

    /**
     * Set dateAccept.
     *
     * @param \DateTime $dateAccept
     *
     * @return Order
     */
    public function setDateAccept($dateAccept)
    {
        $this->dateAccept = $dateAccept;

        return $this;
    }

    /**
     * Get dateAccept.
     *
     * @return \DateTime
     */
    public function getDateAccept()
    {
        return $this->dateAccept;
    }

    /**
     * Set dateHandle.
     *
     * @param \DateTime $dateHandle
     *
     * @return Order
     */
    public function setDateHandle($dateHandle)
    {
        $this->dateHandle = $dateHandle;

        return $this;
    }

    /**
     * Get dateHandle.
     *
     * @return \DateTime
     */
    public function getDateHandle()
    {
        return $this->dateHandle;
    }

    /**
     * Set dateUpdated.
     *
     * @param \DateTime $dateUpdated
     *
     * @return Order
     */
    public function setDateUpdated($dateUpdated)
    {
        $this->dateUpdated = $dateUpdated;

        return $this;
    }

    public function getDateDelivered(): \DateTime
    {
        return $this->dateDelivered;
    }

    public function setDateDelivered(\DateTime $dateDelivered): void
    {
        $this->dateDelivered = $dateDelivered;
    }

    /**
     * Get dateUpdated.
     *
     * @return \DateTime
     */
    public function getDateUpdated()
    {
        return $this->dateUpdated;
    }

    /**
     * Set dateDue.
     *
     * @param \DateTime $dateDue
     *
     * @return Order
     */
    public function setDateDue($dateDue)
    {
        $this->dateDue = $dateDue;

        return $this;
    }

    /**
     * Get dateDue.
     *
     * @return \DateTime
     */
    public function getDateDue()
    {
        return $this->dateDue;
    }

    /**
     * Set status.
     *
     * @param bool $status
     *
     * @return Order
     */
    public function setStatus($status)
    {
        $this->status = $status;

        return $this;
    }

    /**
     * Get status.
     *
     * @return bool
     */
    public function getStatus()
    {
        return $this->status;
    }

    /**
     * Set statusPayed.
     *
     * @param bool $statusPayed
     *
     * @return Order
     */
    public function setStatusPayed($statusPayed)
    {
        $this->statusPayed = $statusPayed;

        return $this;
    }

    /**
     * Get statusPayed.
     *
     * @return bool
     */
    public function getStatusPayed()
    {
        return $this->statusPayed;
    }

    /**
     * Set statusDispatch.
     *
     * @param bool $statusDispatch
     *
     * @return Order
     */
    public function setStatusDispatch($statusDispatch)
    {
        $this->statusDispatch = $statusDispatch;

        return $this;
    }

    /**
     * Get statusDispatch.
     *
     * @return bool
     */
    public function getStatusDispatch()
    {
        return $this->statusDispatch;
    }

    /**
     * Set statusStorno.
     *
     * @param bool $statusStorno
     *
     * @return Order
     */
    public function setStatusStorno($statusStorno)
    {
        $this->statusStorno = $statusStorno;

        return $this;
    }

    /**
     * Get statusStorno.
     *
     * @return bool
     */
    public function getStatusStorno()
    {
        return $this->statusStorno;
    }

    /**
     * Set totalPrice.
     *
     * @param string $totalPrice
     *
     * @return Order
     */
    public function setTotalPrice($totalPrice)
    {
        $this->totalPrice = $totalPrice;

        return $this;
    }

    /**
     * Get totalPrice.
     *
     * @return string
     */
    public function getTotalPrice()
    {
        return $this->totalPrice;
    }

    /**
     * Set invoiceName.
     *
     * @param string $invoiceName
     *
     * @return Order
     */
    public function setInvoiceName($invoiceName)
    {
        $this->invoiceName = $invoiceName;

        return $this;
    }

    /**
     * Get invoiceName.
     *
     * @return string
     */
    public function getInvoiceName()
    {
        return $this->invoiceName;
    }

    /**
     * Set invoiceSurname.
     *
     * @param string $invoiceSurname
     *
     * @return Order
     */
    public function setInvoiceSurname($invoiceSurname)
    {
        $this->invoiceSurname = $invoiceSurname;

        return $this;
    }

    /**
     * Get invoiceSurname.
     *
     * @return string
     */
    public function getInvoiceSurname()
    {
        return $this->invoiceSurname;
    }

    /**
     * Set invoiceFirm.
     *
     * @param string $invoiceFirm
     *
     * @return Order
     */
    public function setInvoiceFirm($invoiceFirm)
    {
        $this->invoiceFirm = $invoiceFirm;

        return $this;
    }

    /**
     * Get invoiceFirm.
     *
     * @return string
     */
    public function getInvoiceFirm()
    {
        return $this->invoiceFirm;
    }

    /**
     * Set invoiceIco.
     *
     * @param string $invoiceIco
     *
     * @return Order
     */
    public function setInvoiceIco($invoiceIco)
    {
        $this->invoiceIco = $invoiceIco;

        return $this;
    }

    /**
     * Get invoiceIco.
     *
     * @return string
     */
    public function getInvoiceIco()
    {
        return $this->invoiceIco;
    }

    /**
     * Set invoiceDic.
     *
     * @param string $invoiceDic
     *
     * @return Order
     */
    public function setInvoiceDic($invoiceDic)
    {
        $this->invoiceDic = $invoiceDic;

        return $this;
    }

    /**
     * Get invoiceDic.
     *
     * @return string
     */
    public function getInvoiceDic()
    {
        return $this->invoiceDic;
    }

    /**
     * Set invoiceStreet.
     *
     * @param string $invoiceStreet
     *
     * @return Order
     */
    public function setInvoiceStreet($invoiceStreet)
    {
        $this->invoiceStreet = $invoiceStreet;

        return $this;
    }

    /**
     * Get invoiceStreet.
     *
     * @return string
     */
    public function getInvoiceStreet()
    {
        return $this->invoiceStreet;
    }

    /**
     * Set invoiceCity.
     *
     * @param string $invoiceCity
     *
     * @return Order
     */
    public function setInvoiceCity($invoiceCity)
    {
        $this->invoiceCity = $invoiceCity;

        return $this;
    }

    /**
     * Get invoiceCity.
     *
     * @return string
     */
    public function getInvoiceCity()
    {
        return $this->invoiceCity;
    }

    /**
     * Set invoiceZip.
     *
     * @param string $invoiceZip
     *
     * @return Order
     */
    public function setInvoiceZip($invoiceZip)
    {
        $this->invoiceZip = $invoiceZip;

        return $this;
    }

    /**
     * Get invoiceZip.
     *
     * @return string
     */
    public function getInvoiceZip()
    {
        return $this->invoiceZip;
    }

    /**
     * Set invoiceCountry.
     *
     * @param string $invoiceCountry
     *
     * @return Order
     */
    public function setInvoiceCountry($invoiceCountry)
    {
        $this->invoiceCountry = $invoiceCountry;

        return $this;
    }

    /**
     * Get invoiceCountry.
     *
     * @return string
     */
    public function getInvoiceCountry()
    {
        return $this->invoiceCountry;
    }

    /**
     * Set invoicePhone.
     *
     * @param string $invoicePhone
     *
     * @return Order
     */
    public function setInvoicePhone($invoicePhone)
    {
        $this->invoicePhone = $invoicePhone;

        return $this;
    }

    /**
     * Get invoicePhone.
     *
     * @return string
     */
    public function getInvoicePhone()
    {
        return $this->invoicePhone;
    }

    /**
     * Set invoiceEmail.
     *
     * @param string $invoiceEmail
     *
     * @return Order
     */
    public function setInvoiceEmail($invoiceEmail)
    {
        $this->invoiceEmail = $invoiceEmail;

        return $this;
    }

    /**
     * Get invoiceEmail.
     *
     * @return string
     */
    public function getInvoiceEmail()
    {
        return $this->invoiceEmail;
    }

    /**
     * Set deliveryName.
     *
     * @param string $deliveryName
     *
     * @return Order
     */
    public function setDeliveryName($deliveryName)
    {
        $this->deliveryName = $deliveryName;

        return $this;
    }

    /**
     * Get deliveryName.
     *
     * @return string
     */
    public function getDeliveryName()
    {
        return $this->deliveryName;
    }

    /**
     * Set deliverySurname.
     *
     * @param string $deliverySurname
     *
     * @return Order
     */
    public function setDeliverySurname($deliverySurname)
    {
        $this->deliverySurname = $deliverySurname;

        return $this;
    }

    /**
     * Get deliverySurname.
     *
     * @return string
     */
    public function getDeliverySurname()
    {
        return $this->deliverySurname;
    }

    /**
     * Set deliveryFirm.
     *
     * @param string $deliveryFirm
     *
     * @return Order
     */
    public function setDeliveryFirm($deliveryFirm)
    {
        $this->deliveryFirm = $deliveryFirm;

        return $this;
    }

    /**
     * Get deliveryFirm.
     *
     * @return string
     */
    public function getDeliveryFirm()
    {
        return $this->deliveryFirm;
    }

    /**
     * Set deliveryStreet.
     *
     * @param string $deliveryStreet
     *
     * @return Order
     */
    public function setDeliveryStreet($deliveryStreet)
    {
        $this->deliveryStreet = $deliveryStreet;

        return $this;
    }

    /**
     * Get deliveryStreet.
     *
     * @return string
     */
    public function getDeliveryStreet()
    {
        return $this->deliveryStreet;
    }

    /**
     * Set deliveryCity.
     *
     * @param string $deliveryCity
     *
     * @return Order
     */
    public function setDeliveryCity($deliveryCity)
    {
        $this->deliveryCity = $deliveryCity;

        return $this;
    }

    /**
     * Get deliveryCity.
     *
     * @return string
     */
    public function getDeliveryCity()
    {
        return $this->deliveryCity;
    }

    /**
     * Set deliveryZip.
     *
     * @param string $deliveryZip
     *
     * @return Order
     */
    public function setDeliveryZip($deliveryZip)
    {
        $this->deliveryZip = $deliveryZip;

        return $this;
    }

    /**
     * Get deliveryZip.
     *
     * @return string
     */
    public function getDeliveryZip()
    {
        return $this->deliveryZip;
    }

    /**
     * Set deliveryCountry.
     *
     * @param string $deliveryCountry
     *
     * @return Order
     */
    public function setDeliveryCountry($deliveryCountry)
    {
        $this->deliveryCountry = $deliveryCountry;

        return $this;
    }

    /**
     * Get deliveryCountry.
     *
     * @return string
     */
    public function getDeliveryCountry()
    {
        return $this->deliveryCountry;
    }

    /**
     * Set deliveryType.
     *
     * @param string $deliveryType
     *
     * @return Order
     */
    public function setDeliveryType($deliveryType)
    {
        $this->deliveryType = $deliveryType;

        return $this;
    }

    /**
     * Get deliveryType.
     *
     * @return string
     */
    public function getDeliveryType()
    {
        return $this->deliveryType;
    }

    /**
     * Set deliveryComplete.
     *
     * @param string $deliveryComplete
     *
     * @return Order
     */
    public function setDeliveryComplete($deliveryComplete)
    {
        $this->deliveryComplete = $deliveryComplete;

        return $this;
    }

    /**
     * Get deliveryComplete.
     *
     * @return string
     */
    public function getDeliveryComplete()
    {
        return $this->deliveryComplete;
    }

    /**
     * Set noteUser.
     *
     * @param string $noteUser
     *
     * @return Order
     */
    public function setNoteUser($noteUser)
    {
        $this->noteUser = $noteUser;

        return $this;
    }

    /**
     * Get noteUser.
     *
     * @return string
     */
    public function getNoteUser()
    {
        return $this->noteUser;
    }

    /**
     * Set userOrderNo.
     *
     * @param string $userOrderNo
     *
     * @return Order
     */
    public function setUserOrderNo($userOrderNo)
    {
        $this->userOrderNo = $userOrderNo;

        return $this;
    }

    /**
     * Get userOrderNo.
     *
     * @return string
     */
    public function getUserOrderNo()
    {
        return $this->userOrderNo;
    }

    /**
     * Set noteAdmin.
     *
     * @param string $noteAdmin
     *
     * @return Order
     */
    public function setNoteAdmin($noteAdmin)
    {
        $this->noteAdmin = $noteAdmin;

        return $this;
    }

    /**
     * Get noteAdmin.
     *
     * @return string
     */
    public function getNoteAdmin()
    {
        return $this->noteAdmin;
    }

    /**
     * Set idUser.
     *
     * @return Order
     */
    public function setIdUser(?User $idUser = null)
    {
        $this->idUser = $idUser;

        return $this;
    }

    /**
     * Get idUser.
     *
     * @return \KupShop\UserBundle\Entity\User
     */
    public function getIdUser()
    {
        return $this->idUser;
    }

    /**
     * Constructor.
     */
    public function __construct()
    {
        $this->items = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Add item.
     *
     * @return Order
     */
    public function addItem(OrderItem $item)
    {
        $this->items[] = $item;

        return $this;
    }

    /**
     * Remove item.
     */
    public function removeItem(OrderItem $item)
    {
        $this->items->removeElement($item);
    }

    /**
     * Get items.
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getItems()
    {
        return $this->items;
    }
}
