<?php

/**
 * Created by PhpStorm.
 * User: wpj
 * Date: 2.11.17
 * Time: 12:19.
 */

namespace KupShop\OrderingBundle\Event;

use Symfony\Contracts\EventDispatcher\Event;

class OrderEvent extends Event
{
    /** Objednavka je cerstve vytvorena, ma svoje cislo, ale nema produkty */
    public const ORDER_CREATED = 'kupshop.order.created';

    /** Objednavka je komplet vytvorena, s produkty, spravna cena, doprava... Jeste neni odeslany email, je ve stavu -1 */
    public const ORDER_COMPLETE = 'kupshop.order.complete';

    /** Odeslani objednavky je hotovo. Objednavka je ve stavu 0, odeslany email zakaznikovi. */
    public const ORDER_FINISHED = 'kupshop.order.finished';

    /** Dokonceni editace objednavky */
    public const ORDER_EDITED = 'kupshop.order.edited';

    /** @var string Dokonceni editace objednavky uzivatelem. Pres frontend editaci */
    public const USER_EDITED = 'kupshop.order.user_edited';

    /** Stornovani objednavky */
    public const ORDER_STORNO = 'kupshop.order.storno';

    /** Stav objednavky byl zmenen. */
    public const ORDER_STATUS_CHANGED = 'kupshop.order.status_changed';

    /** Objednávka byla zpracována - nastavil se ji date_handle */
    public const ORDER_HANDLED = 'kupshop.order.handled';

    /** Objednavka byla zaplacena. */
    public const ORDER_PAID = 'kupshop.order.paid';

    /** Objednavka nezaplacena - zmena stavu z PAID to UNPAID. */
    public const ORDER_UNPAID = 'kupshop.order.unpaid';

    /** Změna typu dopravy */
    public const ORDER_DELIVERY_CHANGED = 'kupshop.order.delivery_changed';

    private \Order $order;
    private ?\Cart $cart = null;

    public function __construct(\Order $order)
    {
        $this->order = $order;
    }

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

    public function getCart(): ?\Cart
    {
        return $this->cart;
    }

    public function setCart(\Cart $cart)
    {
        $this->cart = $cart;
    }
}
