groups:
  - name: Piwigo Configuration
    description: Configure Piwigo
  - name: User and Group Configuration
    description: Configure User and Group for Piwigo
  - name: Network Configuration
    description: Configure Network for Piwigo
  - name: Storage Configuration
    description: Configure Storage for Piwigo
  - name: Resources Configuration
    description: Configure Resources for Piwigo

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: piwiConfig
    label: ""
    group: Piwigo Configuration
    schema:
      type: dict
      attrs:
        - variable: adminName
          label: Admin Name
          description: |
            The admin name for Piwigo.</br>
            Only used when Piwigo is first installed.</br>
            You can change it later in the Piwigo WebUI.
          schema:
            type: string
            required: true
            immutable: true
            default: ""
        - variable: adminMail
          label: Admin Mail
          description: |
            The admin mail for Piwigo.</br>
            Only used when Piwigo is first installed.</br>
            You can change it later in the Piwigo WebUI.
          schema:
            type: string
            required: true
            immutable: true
            default: ""
        - variable: adminPass
          label: Admin Password
          description: |
            The admin password for Piwigo.</br>
            Only used when Piwigo is first installed.</br>
            You can change it later in the Piwigo WebUI.
          schema:
            type: string
            required: true
            immutable: true
            password: true
            default: ""
        - variable: language
          label: Language
          description: |
            The language for Piwigo.</br>
            Only used when Piwigo is first installed.
          schema:
            type: string
            required: true
            immutable: true
            default: "en_UK"
            enum:
              - value: af_ZA
                description: Afrikaans [ZA]
              - value: es_AR
                description: Argentina [AR]
              - value: az_AZ
                description: Azərbaycanca [AZ]
              - value: id_ID
                description: Bahasa Indonesia [ID]
              - value: pt_BR
                description: Brasil [BR]
              - value: br_FR
                description: Brezhoneg [FR]
              - value: ca_ES
                description: Català [CA]
              - value: da_DK
                description: Dansk [DK]
              - value: de_DE
                description: Deutsch [DE]
              - value: dv_MV
                description: Dhivehi [MV]
              - value: en_GB
                description: English [GB]
              - value: en_UK
                description: English [UK]
              - value: en_US
                description: English [US]
              - value: es_ES
                description: Español [ES]
              - value: eo_EO
                description: Esperanto [EO]
              - value: et_EE
                description: Estonian [EE]
              - value: eu_ES
                description: Euskara [ES]
              - value: fi_FI
                description: Finnish [FI]
              - value: fr_FR
                description: Français [FR]
              - value: fr_CA
                description: Français [QC]
              - value: ga_IE
                description: Gaeilge [IE]
              - value: gl_ES
                description: Galego [ES]
              - value: hr_HR
                description: Hrvatski [HR]
              - value: it_IT
                description: Italiano [IT]
              - value: lv_LV
                description: Latviešu [LV]
              - value: lt_LT
                description: Lietuviu [LT]
              - value: lb_LU
                description: Lëtzebuergesch [LU]
              - value: hu_HU
                description: Magyar [HU]
              - value: ms_MY
                description: Malay [MY]
              - value: es_MX
                description: México [MX]
              - value: nl_NL
                description: Nederlands [NL]
              - value: nb_NO
                description: Norsk bokmål [NO]
              - value: nn_NO
                description: Norwegian nynorsk [NO]
              - value: pl_PL
                description: Polski [PL]
              - value: pt_PT
                description: Português [PT]
              - value: ro_RO
                description: Română [RO]
              - value: sk_SK
                description: Slovensky [SK]
              - value: sl_SI
                description: Slovenšcina [SI]
              - value: sh_RS
                description: Srpski [SR]
              - value: sv_SE
                description: Svenska [SE]
              - value: vi_VN
                description: Tiếng Việt [VN]
              - value: tr_TR
                description: Türkçe [TR]
              - value: wo_SN
                description: Wolof [SN]
              - value: is_IS
                description: Íslenska [IS]
              - value: cs_CZ
                description: Česky [CZ]
              - value: el_GR
                description: Ελληνικά [GR]
              - value: bg_BG
                description: Български [BG]
              - value: mk_MK
                description: Македонски [MK]
              - value: mn_MN
                description: Монгол [MN]
              - value: ru_RU
                description: Русский [RU]
              - value: sr_RS
                description: Српски [SR]
              - value: uk_UA
                description: Українська [UA]
              - value: he_IL
                description: עברית [IL]
              - value: ar_EG
                description: العربية (مص
              - value: ar_SA
                description: العربية [AR]
              - value: ar_MA
                description: العربية [MA]
              - value: fa_IR
                description: پارسی [IR]
              - value: kok_IN
                description: कोंकणी [IN]
              - value: bn_IN
                description: বাংলা[IN]
              - value: gu_IN
                description: ગુજરાતી[IN]
              - value: ta_IN
                description: தமிழ் [IN]
              - value: kn_IN
                description: ಕನ್ನಡ [IN]
              - value: th_TH
                description: ภาษาไทย [TH]
              - value: ka_GE
                description: ქართული [GE]
              - value: km_KH
                description: ខ្មែរ [KH]
              - value: zh_TW
                description: 中文 (繁體) [TW]
              - value: zh_HK
                description: 中文 (香港) [HK]
              - value: ja_JP
                description: 日本語 [JP]
              - value: zh_CN
                description: 简体中文 [CN]
              - value: ko_KR
                description: 한국어 [KR]

        - variable: additionalEnvs
          label: Additional Environment Variables
          description: Configure additional environment variables for Piwigo.
          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: piwiID
    label: ""
    group: User and Group Configuration
    schema:
      type: dict
      attrs:
        - variable: user
          label: User ID
          description: The user id that Piwigo files will be owned by.
          schema:
            type: int
            min: 2
            default: 568
            required: true
        - variable: group
          label: Group ID
          description: The group id that Piwigo files will be owned by.
          schema:
            type: int
            min: 2
            default: 568
            required: true

  - variable: piwiNetwork
    label: ""
    group: Network Configuration
    schema:
      type: dict
      attrs:
        - variable: webPort
          label: Web Port
          description: The port for the Piwigo WebUI.
          schema:
            type: int
            default: 30066
            min: 9000
            max: 65535
            required: true

  - variable: piwiStorage
    label: ""
    group: Storage Configuration
    schema:
      type: dict
      attrs:
        - variable: config
          label: Piwigo Configuration Storage
          description: The path to store Piwigo configuration.
          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: ixVolumeConfig
                label: ixVolume Configuration
                description: The configuration for the ixVolume dataset.
                schema:
                  type: dict
                  show_if: [["type", "=", "ixVolume"]]
                  $ref:
                    - "normalize/ixVolume"
                  attrs:
                    - variable: aclEnable
                      label: Enable ACL
                      description: Enable ACL for the dataset.
                      schema:
                        type: boolean
                        default: false
                    - variable: datasetName
                      label: Dataset Name
                      description: The name of the dataset to use for storage.
                      schema:
                        type: string
                        required: true
                        immutable: true
                        hidden: true
                        default: "config"
                    - variable: aclEntries
                      label: ACL Configuration
                      schema:
                        type: dict
                        show_if: [["aclEnable", "=", true]]
                        attrs: []
              - variable: hostPathConfig
                label: Host Path Configuration
                schema:
                  type: dict
                  show_if: [["type", "=", "hostPath"]]
                  attrs:
                    - variable: aclEnable
                      label: Enable ACL
                      description: Enable ACL for the dataset.
                      schema:
                        type: boolean
                        default: false
                    - variable: acl
                      label: ACL Configuration
                      schema:
                        type: dict
                        show_if: [["aclEnable", "=", true]]
                        attrs: []
                        $ref:
                          - "normalize/acl"
                    - variable: hostPath
                      label: Host Path
                      description: The host path to use for storage.
                      schema:
                        type: hostpath
                        show_if: [["aclEnable", "=", false]]
                        required: true

        - variable: gallery
          label: Piwigo Gallery Storage
          description: The path to store Piwigo gallery.
          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: ixVolumeConfig
                label: ixVolume Configuration
                description: The configuration for the ixVolume dataset.
                schema:
                  type: dict
                  show_if: [["type", "=", "ixVolume"]]
                  $ref:
                    - "normalize/ixVolume"
                  attrs:
                    - variable: aclEnable
                      label: Enable ACL
                      description: Enable ACL for the dataset.
                      schema:
                        type: boolean
                        default: false
                    - variable: datasetName
                      label: Dataset Name
                      description: The name of the dataset to use for storage.
                      schema:
                        type: string
                        required: true
                        immutable: true
                        hidden: true
                        default: "gallery"
                    - variable: aclEntries
                      label: ACL Configuration
                      schema:
                        type: dict
                        show_if: [["aclEnable", "=", true]]
                        attrs: []
              - variable: hostPathConfig
                label: Host Path Configuration
                schema:
                  type: dict
                  show_if: [["type", "=", "hostPath"]]
                  attrs:
                    - variable: aclEnable
                      label: Enable ACL
                      description: Enable ACL for the dataset.
                      schema:
                        type: boolean
                        default: false
                    - variable: acl
                      label: ACL Configuration
                      schema:
                        type: dict
                        show_if: [["aclEnable", "=", true]]
                        attrs: []
                        $ref:
                          - "normalize/acl"
                    - variable: hostPath
                      label: Host Path
                      description: The host path to use for storage.
                      schema:
                        type: hostpath
                        show_if: [["aclEnable", "=", false]]
                        required: true

        - variable: mariadbData
          label: Piwigo MariaDB Data Storage
          description: The path to store Piwigo MariaDB 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: ixVolumeConfig
                label: ixVolume Configuration
                description: The configuration for the ixVolume dataset.
                schema:
                  type: dict
                  # Nothing to show for the user
                  hidden: true
                  show_if: [["type", "=", "ixVolume"]]
                  $ref:
                    - "normalize/ixVolume"
                  attrs:
                    - variable: aclEnable
                      label: Enable ACL
                      description: Enable ACL for the dataset.
                      schema:
                        type: boolean
                        # MariaDB does a CHMOD at startup
                        # Which fails with ACL
                        hidden: true
                        default: false
                    - variable: datasetName
                      label: Dataset Name
                      description: The name of the dataset to use for storage.
                      schema:
                        type: string
                        required: true
                        immutable: true
                        hidden: true
                        default: mariadbData
                    - variable: aclEntries
                      label: ACL Configuration
                      schema:
                        type: dict
                        show_if: [["aclEnable", "=", true]]
                        attrs: []
              - variable: hostPathConfig
                label: Host Path Configuration
                schema:
                  type: dict
                  show_if: [["type", "=", "hostPath"]]
                  attrs:
                    - variable: aclEnable
                      label: Enable ACL
                      description: Enable ACL for the dataset.
                      schema:
                        type: boolean
                        # MariaDB does a CHMOD at startup
                        # Which fails with ACL
                        hidden: true
                        default: false
                    - variable: acl
                      label: ACL Configuration
                      schema:
                        type: dict
                        show_if: [["aclEnable", "=", true]]
                        attrs: []
                        $ref:
                          - "normalize/acl"
                    - variable: hostPath
                      label: Host Path
                      description: The host path to use for storage.
                      schema:
                        type: hostpath
                        show_if: [["aclEnable", "=", false]]
                        required: true

        - variable: mariadbBackup
          label: Piwigo MariaDB Backup Storage
          description: The path to store Piwigo MariaDB Backup.
          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: ixVolumeConfig
                label: ixVolume Configuration
                description: The configuration for the ixVolume dataset.
                schema:
                  type: dict
                  # Nothing to show for the user
                  hidden: true
                  show_if: [["type", "=", "ixVolume"]]
                  $ref:
                    - "normalize/ixVolume"
                  attrs:
                    - variable: aclEnable
                      label: Enable ACL
                      description: Enable ACL for the dataset.
                      schema:
                        type: boolean
                        # MariaDB does a CHMOD at startup
                        # Which fails with ACL
                        hidden: true
                        default: false
                    - variable: datasetName
                      label: Dataset Name
                      description: The name of the dataset to use for storage.
                      schema:
                        type: string
                        required: true
                        immutable: true
                        hidden: true
                        default: mariadbBackup
                    - variable: aclEntries
                      label: ACL Configuration
                      schema:
                        type: dict
                        show_if: [["aclEnable", "=", true]]
                        attrs: []
              - variable: hostPathConfig
                label: Host Path Configuration
                schema:
                  type: dict
                  show_if: [["type", "=", "hostPath"]]
                  attrs:
                    - variable: aclEnable
                      label: Enable ACL
                      description: Enable ACL for the dataset.
                      schema:
                        type: boolean
                        # MariaDB does a CHMOD at startup
                        # Which fails with ACL
                        hidden: true
                        default: false
                    - variable: acl
                      label: ACL Configuration
                      schema:
                        type: dict
                        show_if: [["aclEnable", "=", true]]
                        attrs: []
                        $ref:
                          - "normalize/acl"
                    - variable: hostPath
                      label: Host Path
                      description: The host path to use for storage.
                      schema:
                        type: hostpath
                        show_if: [["aclEnable", "=", false]]
                        required: true

        - variable: additionalStorages
          label: Additional Storage
          description: Additional storage for Piwigo.
          schema:
            type: list
            default: []
            items:
              - variable: storageEntry
                label: Storage Entry
                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.</br>
                        SMB Share: Is a SMB share that is mounted to a persistent volume claim.
                      schema:
                        type: string
                        required: true
                        default: "ixVolume"
                        immutable: true
                        enum:
                          - value: "hostPath"
                            description: Host Path (Path that already exists on the system)
                          - value: "ixVolume"
                            description: ixVolume (Dataset created automatically by the system)
                          - value: "smb-pv-pvc"
                            description: SMB Share (Mounts a persistent volume claim to a SMB share)
                    - variable: readOnly
                      label: Read Only
                      description: Mount the volume as read only.
                      schema:
                        type: boolean
                        default: false
                    - variable: mountPath
                      label: Mount Path
                      description: The path inside the container to mount the storage.
                      schema:
                        type: path
                        required: true
                    - variable: hostPathConfig
                      label: Host Path Configuration
                      schema:
                        type: dict
                        show_if: [["type", "=", "hostPath"]]
                        attrs:
                          - variable: aclEnable
                            label: Enable ACL
                            description: Enable ACL for the dataset.
                            schema:
                              type: boolean
                              default: false
                          - variable: acl
                            label: ACL Configuration
                            schema:
                              type: dict
                              show_if: [["aclEnable", "=", true]]
                              attrs: []
                              $ref:
                                - "normalize/acl"
                          - variable: hostPath
                            label: Host Path
                            description: The host path to use for storage.
                            schema:
                              type: hostpath
                              show_if: [["aclEnable", "=", false]]
                              required: true
                    - variable: ixVolumeConfig
                      label: ixVolume Configuration
                      description: The configuration for the ixVolume dataset.
                      schema:
                        type: dict
                        show_if: [["type", "=", "ixVolume"]]
                        $ref:
                          - "normalize/ixVolume"
                        attrs:
                          - variable: aclEnable
                            label: Enable ACL
                            description: Enable ACL for the dataset.
                            schema:
                              type: boolean
                              default: false
                          - variable: datasetName
                            label: Dataset Name
                            description: The name of the dataset to use for storage.
                            schema:
                              type: string
                              required: true
                              immutable: true
                              default: "storage_entry"
                          - variable: aclEntries
                            label: ACL Configuration
                            schema:
                              type: dict
                              show_if: [["aclEnable", "=", true]]
                              attrs: []
                    - variable: smbConfig
                      label: SMB Share Configuration
                      description: The configuration for the SMB Share.
                      schema:
                        type: dict
                        show_if: [["type", "=", "smb-pv-pvc"]]
                        attrs:
                          - variable: server
                            label: Server
                            description: The server for the SMB share.
                            schema:
                              type: string
                              required: true
                          - variable: share
                            label: Share
                            description: The share name for the SMB share.
                            schema:
                              type: string
                              required: true
                          - variable: domain
                            label: Domain (Optional)
                            description: The domain for the SMB share.
                            schema:
                              type: string
                          - variable: username
                            label: Username
                            description: The username for the SMB share.
                            schema:
                              type: string
                              required: true
                          - variable: password
                            label: Password
                            description: The password for the SMB share.
                            schema:
                              type: string
                              required: true
                              private: true
                          - variable: size
                            label: Size (in Gi)
                            description: The size of the volume quota.
                            schema:
                              type: int
                              required: true
                              min: 1
                              default: 1

  - variable: resources
    label: ""
    group: Resources Configuration
    schema:
      type: dict
      attrs:
        - variable: limits
          label: Limits
          schema:
            type: dict
            attrs:
              - variable: cpu
                label: CPU
                description: CPU limit for Piwigo.
                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 Piwigo.
                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
