groups:
  - name: Mumble Configuration
    description: Configure Mumble
  - name: Network Configuration
    description: Configure Network for Mumble
  - name: Storage Configuration
    description: Configure Storage for Mumble
  - name: Resources Configuration
    description: Configure Resources for Mumble

questions:
  - variable: mumbleConfig
    label: ""
    group: Mumble Configuration
    schema:
      type: dict
      attrs:
        - variable: serverPassword
          label: Server Password
          description: The password for the Mumble Server.
          schema:
            type: string
            empty: false
            required: true
            private: true
        - variable: superUserPassword
          label: Super User Password
          description: The password for the Mumble Super User.
          schema:
            type: string
            empty: false
            required: true
            private: true
        - variable: iceSecretRead
          label: Ice Secret Read
          description: The Ice Secret for Read Operations.
          schema:
            type: string
            empty: false
            required: true
            private: true
        - variable: iceSecretWrite
          label: Ice Secret Write
          description: The Ice Secret for Write Operations.
          schema:
            type: string
            empty: false
            required: true
            private: true
        - variable: users
          label: Users
          description: The maximum number of users for the Mumble Server.
          schema:
            type: int
            default: 100
            required: true
        - variable: welcomeText
          label: Welcome Text
          description: The welcome text for the Mumble Server.
          schema:
            type: string
            default: Welcome to Mumble!
            required: true
        - variable: additionalEnvs
          label: Additional Environment Variables
          description: Configure additional environment variables for Mumble.
          schema:
            type: list
            default: []
            items:
              - variable: env
                label: Environment Variable
                schema:
                  type: dict
                  attrs:
                    - variable: name
                      label: Name
                      schema:
                        type: string
                        required: true
                    - variable: value
                      label: Value
                      schema:
                        type: string
                        required: true

  - variable: mumbleNetwork
    label: ""
    group: Network Configuration
    schema:
      type: dict
      attrs:
        - variable: serverPort
          label: Server Port
          description: The port for the Mumble Server (UDP & TCP).
          schema:
            type: int
            default: 30018
            min: 9000
            max: 65535
            required: true
        - variable: icePort
          label: Ice Port
          description: The port for the Ice.
          schema:
            type: int
            default: 30019
            min: 9000
            max: 65535
            required: true
        - variable: certificateID
          label: Certificate
          description: The certificate to use for Mumble
          schema:
            type: int
            "null": true
            $ref:
              - "definitions/certificate"

  - variable: mumbleStorage
    label: ""
    group: Storage Configuration
    schema:
      type: dict
      attrs:
        - variable: data
          label: Mumble Data Storage
          description: The path to store Mumble Data.
          schema:
            type: dict
            attrs:
              - variable: type
                label: Type
                description: |
                  ixVolume: Is dataset created automatically by the system.</br>
                  Host Path: Is a path that already exists on the system.
                schema:
                  type: string
                  required: true
                  immutable: true
                  default: ixVolume
                  enum:
                    - value: hostPath
                      description: Host Path (Path that already exists on the system)
                    - value: ixVolume
                      description: ixVolume (Dataset created automatically by the system)
              - variable: datasetName
                label: Dataset Name
                schema:
                  type: string
                  show_if: [["type", "=", "ixVolume"]]
                  required: true
                  hidden: true
                  immutable: true
                  default: data
                  $ref:
                    - "normalize/ixVolume"
              - variable: hostPath
                label: Host Path
                schema:
                  type: hostpath
                  show_if: [["type", "=", "hostPath"]]
                  required: true

  - variable: resources
    label: Resources Configuration
    group: Resources Configuration
    schema:
      type: dict
      attrs:
        - variable: limits
          label: Limits
          schema:
            type: dict
            attrs:
              - variable: cpu
                label: CPU
                description: CPU limit for Mumble.
                schema:
                  type: string
                  max_length: 6
                  valid_chars: '^(0\.[1-9]|[1-9][0-9]*)(\.[0-9]|m?)$'
                  valid_chars_error: |
                    Valid CPU limit formats are</br>
                    - Plain Integer - eg. 1</br>
                    - Float - eg. 0.5</br>
                    - Milicpu - eg. 500m
                  default: "4000m"
                  required: true
              - variable: memory
                label: Memory
                description: Memory limit for Mumble.
                schema:
                  type: string
                  max_length: 12
                  valid_chars: '^[1-9][0-9]*([EPTGMK]i?|e[0-9]+)?$'
                  valid_chars_error: |
                    Valid Memory limit formats are</br>
                    - Suffixed with E/P/T/G/M/K - eg. 1G</br>
                    - Suffixed with Ei/Pi/Ti/Gi/Mi/Ki - eg. 1Gi</br>
                    - Plain Integer in bytes - eg. 1024</br>
                    - Exponent - eg. 134e6
                  default: "8Gi"
                  required: true
