# there is no need to use get_class for the spooler function because you
# can not override it. There cannot be 2 spooler functions in uwsgi with the
# same name, which is what you would end up with if you'd override the spooler
# function in an app extension.
import ocyan.plugin.oscar.signals

from .spooler import (
    send_new_order_status_message_async,
    send_order_confirmation_message_async,
)


def send_order_confirmation_message(event_type, order):
    send_order_confirmation_message_async.spool(
        event_type=event_type, order_id=str(order.pk)
    )
    ocyan.plugin.oscar.signals.order_ready.send(sender=order.__class__, order=order)


def send_new_order_status_message(event_type, order):
    send_new_order_status_message_async.spool(
        event_type=event_type, order_id=str(order.pk)
    )
