{
        "description": "Automatically convert accepted quotation to invoice",
        "trigger": {
            "event": "quotation:status:accepted",
            "table": "quotations",
            "condition": "status == \"accepted\" && converted_invoice_id == null"
        },
        "steps": [
            {
                "order": 1,
                "type": "action",
                "action": "quotations:convert",
                "description": "Convert quotation to invoice",
                "params": {
                    "auto_send": false
                }
            },
            {
                "order": 2,
                "type": "update",
                "table": "quotations",
                "fields": {
                    "status": "converted",
                    "converted_invoice_id": "{created_invoice_id}",
                    "accepted_at": "NOW()"
                },
                "description": "Update quotation with conversion info"
            },
            {
                "order": 3,
                "type": "notification",
                "recipients": ["created_by"],
                "template": "quotation_converted",
                "data": {
                    "quotation_number": "{quotation_number}",
                    "invoice_number": "{created_invoice.invoice_number}",
                    "amount": "{total_amount}"
                },
                "description": "Notify about successful conversion"
            },
            {
                "order": 4,
                "type": "emit",
                "event": "invoice:created:from:quotation",
                "data": {
                    "quotation_id": "{quotation_id}",
                    "invoice_id": "{created_invoice_id}"
                }
            }
        ],
        "onSuccess": {
            "notification": {
                "recipients": ["created_by"],
                "message": "Quotation {quotation_number} converted to invoice"
            }
        }
    }