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: create-git-repo
      name: Create Git Repository
      action: git:createRepository
      input:
        repoName: chicken-tenders-order-${{ parameters.quantity }}
        repoDescription: 'Chicken tenders order with quantity and dipping sauces'
        repoVisibility: private
        owner: '{{owner}}'
    - id: write-order-file
      name: Write Order File
      action: file:write
      input:
        targetPath: 'order.txt'
        content: |
          Quantity: ${{ parameters.quantity }}
          Dipping Sauces: ${{ parameters.sauces }}
    - id: commit-order-file
      name: Commit and Push Order File
      action: git:commitAndPush
      input:
        repoRef: ${{ steps['create-git-repo'].output.repoRef }}
        files:
          - order.txt
        commitMessage: 'Initial commit for chicken tenders order'
  output:
    links:
      - url: '${{ steps["create-git-repo"].output.repositoryUrl }}'
        title: 'Git Repository for Chicken Tenders Order'