groups:
  - name: Nginx Proxy Manager Configuration
    description: Configure Nginx Proxy Manager
  - name: User and Group Configuration
    description: Configure User and Group for Nginx Proxy Manager
  - name: Network Configuration
    description: Configure Network for Nginx Proxy Manager
  - name: Storage Configuration
    description: Configure Storage for Nginx Proxy Manager
  - name: Resources Configuration
    description: Configure Resources for Nginx Proxy Manager

portals:
  web_portal:
    protocols:
      - "$kubernetes-resource_configmap_portal_protocol"
    host:
      - "$kubernetes-resource_configmap_portal_host"
    ports:
      - "$kubernetes-resource_configmap_portal_port"
    path: "$kubernetes-resource_configmap_portal_path"

questions:
  - variable: TZ
    group: Nginx Proxy Manager Configuration
    label: Timezone
    schema:
      type: string
      default: Etc/UTC
      required: true
      $ref:
        - definitions/timezone

  - variable: npmConfig
    label: ""
    group: Nginx Proxy Manager Configuration
    schema:
      type: dict
      attrs:
        - variable: additionalEnvs
          label: Additional Environment Variables
          description: Configure additional environment variables for Nginx Proxy Manager.
          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: npmNetwork
    label: ""
    group: Network Configuration
    schema:
      type: dict
      attrs:
        - variable: webPort
          label: Web Port
          description: The port for the Nginx Proxy Manager Web UI.
          schema:
            type: int
            default: 30000
            min: 9000
            max: 65535
            required: true
        - variable: httpPort
          label: HTTP Port
          description: The HTTP port for the Nginx Proxy Manager.
          schema:
            type: int
            default: 30001
            min: 9000
            max: 65535
            required: true
        - variable: httpsPort
          label: HTTPS Port
          description: The HTTP port for the Nginx Proxy Manager.
          schema:
            type: int
            default: 30002
            min: 9000
            max: 65535
            required: true

  - variable: npmStorage
    label: ""
    group: Storage Configuration
    schema:
      type: dict
      attrs:
        - variable: data
          label: Nginx Proxy Manager Data Storage
          description: The path to store Nginx Proxy Manager 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
                  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"]]
                  immutable: true
                  required: true
        - variable: certs
          label: Nginx Proxy Manager Certificate Storage
          description: The path to store Nginx Proxy Manager Certificate.
          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
                  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: "certs"
                  $ref:
                    - "normalize/ixVolume"
              - variable: hostPath
                label: Host Path
                schema:
                  type: hostpath
                  show_if: [["type", "=", "hostPath"]]
                  immutable: true
                  required: true

  - variable: resources
    group: Resources Configuration
    label: ""
    schema:
      type: dict
      attrs:
        - variable: limits
          label: Limits
          schema:
            type: dict
            attrs:
              - variable: cpu
                label: CPU
                description: CPU limit for Nginx Proxy Manager.
                schema:
                  type: string
                  default: "4000m"
                  required: true
              - variable: memory
                label: Memory
                description: Memory limit for Nginx Proxy Manager.
                schema:
                  type: string
                  default: "8Gi"
                  required: true
