apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  # annotation has to be provided in order to enable cr-syncer to cloud
  annotations:
    cr-syncer.cloudrobotics.com/spec-source: cloud
    cr-syncer.cloudrobotics.com/filter-by-robot-name: "True"
  # name must match the spec fields below, and be in the form: <plural>.<group>
  name: warehouseorders.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: warehouseorders
    # singular name to be used as an alias on the CLI and for display
    singular: warehouseorder
    # kind is normally the CamelCased singular type. Your resource manifests use this.
    kind: WarehouseOrder
    # shortNames allow shorter string to match your resource on the CLI
    shortNames:
    - ord
  # 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:
                - data
                - order_status
                - sequence
              properties:
                data:
                  type: object
                  required:
                    - lgnum
                    - who
                    - status
                    - areawho
                    - lgtyp
                    - lgpla
                    - queue
                    - rsrc
                    - lsd
                    - topwhoid
                    - refwhoid
                    - flgwho
                    - flgto
                    - warehousetasks
                  properties:
                    lgnum:
                      type: string
                    who:
                      type: string
                    status:
                      type: string
                    areawho:
                      type: string
                    lgtyp:
                      type: string
                    lgpla:
                      type: string
                    queue:
                      type: string
                    rsrc:
                      type: string
                    lsd:
                      type: integer
                    topwhoid:
                      type: string
                    refwhoid:
                      type: string
                    flgwho:
                      type: boolean
                    flgto:
                      type: boolean
                    warehousetasks:
                      type: array
                      items:
                        type: object
                        required: 
                          - flghuto
                          - lgnum
                          - nlber
                          - nlenr
                          - nlpla
                          - nltyp
                          - priority
                          - procty
                          - tanum
                          - tostat
                          - unitv
                          - unitw
                          - vlber
                          - vlenr
                          - vlpla
                          - vltyp
                          - volum
                          - weight
                          - who
                        properties:
                          flghuto:
                            type: boolean
                          lgnum:
                            type: string
                          nlber:
                            type: string
                          nlenr:
                            type: string
                          nlpla:
                            type: string
                          nltyp:
                            type: string
                          priority:
                            type: integer
                          procty:
                            type: string
                          tanum:
                            type: string
                          tostat:
                            type: string
                          unitv:
                            type: string
                          unitw:
                            type: string
                          vlber:
                            type: string
                          vlenr:
                            type: string
                          vlpla:
                            type: string
                          vltyp:
                            type: string
                          volum:
                            type: number
                          weight:
                            type: number
                          who:
                            type: string
                process_status:
                  type: array
                  items:
                    type: object
                    required:
                      - confirmationdate
                      - confirmationnumber
                      - confirmationtype
                      - lgnum
                      - rsrc
                      - tanum
                      - who
                    properties:
                      confirmationdate:
                        type: string
                      confirmationnumber:
                        type: string
                      confirmationtype:
                        type: string
                      lgnum:
                        type: string
                      rsrc:
                        type: string
                      tanum:
                        type: string
                      who:
                        type: string
                order_status:
                  type: string
                  enum:
                    - RUNNING
                    - PROCESSED
                sequence:
                  type: integer
            status:
              type: object
              properties:
                data:
                  type: array
                  items:
                    type: object
                    required:
                      - confirmationdate
                      - confirmationnumber
                      - confirmationtype
                      - lgnum
                      - rsrc
                      - tanum
                      - who
                    properties:
                      confirmationdate:
                        type: string
                      confirmationnumber:
                        type: string
                      confirmationtype:
                        type: string
                      lgnum:
                        type: string
                      rsrc:
                        type: string
                      tanum:
                        type: string
                      who:
                        type: string
      additionalPrinterColumns:
      - jsonPath: .spec.data.lgnum
        name: EWM Warehouse
        type: string
      - jsonPath: .spec.data.rsrc
        name: EWM Robot
        type: string
      - jsonPath: .spec.order_status
        name: Order Status
        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
