apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: order-chicken-tenders
  title: Order Chicken Tenders
  description: Create an order for chicken tenders with customizable quantity and sauces.
spec:
  owner: kitchen-team
  type: side
  parameters:
    - title: Chicken Tenders Order Configuration
      required:
        - quantity
      properties:
        quantity:
          type: integer
          title: Quantity
          description: Choose the number of chicken tenders.
          minimum: 3
          maximum: 12
        sauces:
          type: array
          title: Dipping Sauces
          description: Choose sauces for the chicken tenders.
          items:
            type: string
            enum:
              - barbecue
              - honey mustard
              - ranch
            enumNames:
              - Barbecue
              - Honey Mustard
              - Ranch
          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: chickentenders
              quantity: ${{ parameters.quantity }}
              sauces: ${{ parameters.sauces }}

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