apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: order-milkshake
  title: Order Milkshake
  description: Create an order for milkshake with customizable flavors and size.
spec:
  owner: customer-service-team
  type: drink
  parameters:
    - title: Milkshake Order Configuration
      required:
        - flavor
        - size
      properties:
        flavor:
          type: string
          title: Flavor
          description: Choose the flavor of the milkshake.
          enum:
            - chocolate
            - vanilla
            - strawberry
            - banana
          enumNames:
            - Chocolate
            - Vanilla
            - Strawberry
            - Banana
        size:
          type: string
          title: Size
          description: Select the milkshake size.
          enum:
            - small
            - medium
            - large
  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: milkshake
              size: ${{ parameters.size }}
              flavor: ${{ parameters.flavor }}

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