apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  # name must match the spec fields below, and be in the form: <plural>.<group>
  name: auctioneers.ewm.sap.com
spec:
  group: ewm.sap.com
  # either Namespaced or Cluster
  scope: Namespaced
  names:
    # plural name to be used in the URL: /apis/<group>/<version>/<plural>
    plural: auctioneers
    # singular name to be used as an alias on the CLI and for display
    singular: auctioneer
    # kind is normally the CamelCased singular type. Your resource manifests use this.
    kind: Auctioneer
    # shortNames allow shorter string to match your resource on the CLI
    shortNames:
    - auct
  # list of versions supported by this CustomResourceDefinition
  versions:
    - name: v1alpha1
      # Each version can be enabled/disabled by Served flag.
      served: true
      # One and only one version must be marked as the storage version.
      storage: true
      subresources:
        status: {}
      schema:
        openAPIV3Schema:
          type: object
          required:
            - spec
          properties:
            spec:
              type: object
              required:
                - scope
                - configuration
              properties:
                scope:
                  type: object
                  required:
                    - lgnum
                    - rsrctype
                    - rsrcgrp
                  properties:
                    lgnum:
                      type: string
                    rsrctype:
                      type: string
                    rsrcgrp:
                      type: string
                configuration:
                  type: object
                  required:
                    - maxOrdersPerRobot
                    - minOrdersPerRobot
                    - minOrdersPerAuction
                  properties:
                    maxOrdersPerRobot:
                      type: integer
                      minimum: 2
                    minOrdersPerRobot:
                      type: integer
                      minimum: 2
                    minOrdersPerAuction:
                      type: integer
                      minimum: 2
            status:
              type: object
              properties:
                availableRobots:
                  type: array
                  items:
                    type: string
                robotsInScope:
                  type: array
                  items:
                    type: string
                warehouseOrdersInProcess:
                  type: integer
                runningAuctions:
                  type: integer          
                status:
                  type: string
                  enum:
                    - WATCHING
                    - WAITING
                    - AUCTION
                    - ERROR
                message:
                  type: string
                lastStatusChangeTime:
                  type: string
                updateTime:
                  type: string
      additionalPrinterColumns:
      - jsonPath: .status.status
        name: Status
        type: string
      - jsonPath: .status.lastStatusChangeTime
        name: Last status change time
        type: string
      - jsonPath: .status.message
        name: Message
        type: string
      - jsonPath: .metadata.creationTimestamp
        description: |-
          CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.

          Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
        name: Age
        type: date
