winzou_state_machine:
    sylius_order_checkout:
        class: "%sylius.model.order.class%"
        property_path: checkoutState
        graph: sylius_order_checkout
        state_machine_class: "%sylius.state_machine.class%"
        states:
            cart: ~
            addressed: ~
            shipping_selected: ~
            shipping_skipped: ~
            payment_skipped: ~
            payment_selected: ~
            completed: ~
        transitions:
            address:
                from: [cart, addressed, shipping_selected, shipping_skipped, payment_selected, payment_skipped]
                to: addressed
            skip_shipping:
                from: [addressed]
                to: shipping_skipped
            select_shipping:
                from: [addressed, shipping_selected, payment_selected, payment_skipped]
                to: shipping_selected
            skip_payment:
                from: [shipping_selected, shipping_skipped]
                to: payment_skipped
            select_payment:
                from: [payment_selected, shipping_skipped, shipping_selected]
                to: payment_selected
            complete:
                from: [payment_selected, payment_skipped]
                to: completed
        callbacks:
            after:
                sylius_process_cart:
                    on: ["select_shipping", "address", "select_payment", "skip_shipping", "skip_payment"]
                    do: ["@sylius.order_processing.order_processor", "process"]
                    args: ["object"]
                    priority: -200
                sylius_create_order:
                    on: ["complete"]
                    do: ["@sm.callback.cascade_transition", "apply"]
                    args: ["object", "event", "'create'", "'sylius_order'"]
                    priority: -400
                sylius_save_checkout_completion_date:
                    on: ["complete"]
                    do: ["object", "completeCheckout"]
                    args: ["object"]
                    priority: -300
                sylius_skip_shipping:
                    on: ["address"]
                    do: ["@sylius.state_resolver.order_checkout", "resolve"]
                    args: ["object"]
                    priority: -100
                sylius_skip_payment:
                    on: ["select_shipping"]
                    do: ["@sylius.state_resolver.order_checkout", "resolve"]
                    args: ["object"]
                    priority: -100
                sylius_control_payment_state:
                    on: ["complete"]
                    do: ["@sylius.state_resolver.order_payment", "resolve"]
                    args: ["object"]
                    priority: -200
                sylius_control_shipping_state:
                    on: ["complete"]
                    do: ["@sylius.state_resolver.order_shipping", "resolve"]
                    args: ["object"]
                    priority: -100
