<?php

namespace KupShop\POSBundle\Event;

use KupShop\OrderingBundle\Entity\Purchase\PurchaseState;
use Symfony\Contracts\EventDispatcher\Event;

class PosOrderEvent extends Event
{
    /** PurchaseState je vytvoren, jeste neni objednavka */
    public const PURCHASE_STATE_CHECK = 'kupshop.pos.purchase_state.check';

    /** PurchaseState je vytvoren, objednavka je vytvořena */
    public const PURCHASE_STATE_ORDER_CREATED = 'kupshop.pos.purchase_state.created';
    public const ORDER_PAID_BY_POS = 'kupshop.pos.order.paid';

    /** @var PurchaseState */
    private $purchaseState;

    /** @var \Order */
    private $order;

    /** @var int */
    private $idPos;

    /** @var bool */
    private $isOrderNew;

    public function __construct(PurchaseState $purchaseState, $idPos, ?\Order $order = null, $isOrderNew = false)
    {
        $this->purchaseState = $purchaseState;
        $this->order = $order;
        $this->idPos = $idPos;
        $this->isOrderNew = $isOrderNew;
    }

    public function getPurchaseState(): PurchaseState
    {
        return $this->purchaseState;
    }

    public function getOrder(): ?\Order
    {
        return $this->order;
    }

    public function setOrder(\Order $order): void
    {
        $this->order = $order;
    }

    public function getIdPos(): int
    {
        return $this->idPos;
    }

    public function isOrderNew(): bool
    {
        return $this->isOrderNew;
    }
}
