apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: order-mozzarella-sticks
  title: Order Mozzarella Sticks
  description: Create an order for mozzarella sticks with customizable quantity and dipping sauces.
spec:
  owner: kitchen-team
  type: side
  parameters:
    - title: Mozzarella Sticks Order Configuration
      required:
        - quantity
      properties:
        quantity:
          type: integer
          title: Quantity
          description: Choose the number of mozzarella sticks (4 or 12).
          minimum: 4
          maximum: 12
        sauces:
          type: array
          title: Dipping Sauces
          description: Choose dipping sauces for the mozzarella sticks.
          items:
            type: string
            enum:
              - marinara
              - ranch
              - barbecue
            enumNames:
              - Marinara
              - Ranch
              - Barbecue
          uniqueItems: true
          ui:widget: checkboxes
  steps:
    - id: submit-order
      name: Submit Order
      action: http:backstage:request
      input:
        method: 'POST'
        path: '/proxy/log-forwarding'
        headers:
          content-type: 'application/json'
        body:
          event:
            action: submit-order
            attributes:
              menu-item: morzerellasticks
              sauces: ${{ parameters.sauces }}
              quantity: ${{ parameters.quantity }}

  output:
    orderResponse: '{{ steps["submit-order"].output.body }}'
    orderStatusCode: '{{ steps["submit-order"].output.code }}'
    orderHeaders: '{{ steps["submit-order"].output.headers }}'