apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: order-hamburger
  title: Order Hamburger
  description: Create an order for a hamburger with customizable size, sauces, and toppings.
spec:
  owner: kitchen
  type: main
  parameters:
    - title: Hamburger Order Configuration
      required:
        - size
      properties:
        size:
          type: string
          title: Size
          description: Choose the size of the hamburger.
          enum:
            - small
            - medium
            - large
        sauces:
          type: array
          title: Sauces
          description: Choose sauces for the hamburger.
          items:
            type: string
          enum:
            - ketchup
            - mustard
            - mayonnaise
          enumNames:
            - Ketchup
            - Mustard
            - Mayonnaise
        toppings:
          type: array
          title: Toppings
          description: Choose toppings for the hamburger.
          items:
            type: string
          enum:
            - lettuce
            - tomato
            - onion
            - pickle
          enumNames:
            - Lettuce
            - Tomato
            - Onion
            - Pickle
  steps:
    - id: create-git-repo
      name: Create Git Repository
      action: git:createRepository
      input:
        repoName: hamburger-order-${{ parameters.size }}
        repoDescription: 'Hamburger order with size, sauces, and toppings'
        repoVisibility: private
        owner: '{{owner}}'
    - id: write-order-file
      name: Write Order File
      action: file:write
      input:
        targetPath: 'order.txt'
        content: |
          Hamburger Size: ${{ parameters.size }}
          Sauces: ${{ parameters.sauces }}
          Toppings: ${{ parameters.toppings }}
    - 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 hamburger order'
  output:
    links:
      - url: '${{ steps["create-git-repo"].output.repositoryUrl }}'
        title: 'Git Repository for Hamburger Order'