# .gitlab-ci.yml -- Pamhyr gitlab-ci
# Copyright (C) 2023-2025  INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

stages:
  - downloads
  - configure
  - test
  - build
  - package
  - hash
  - antivirus
  - release

#########################
# PYINSTALLER VARIABLES #
#########################

variables:
  HIDDEN_IMPORTS: "--hiddenimport rasterio --collect-submodules rasterio"

#############
# DOWNLOADS #
#############

variables:
  MAGE_8_VERSION: "permalink/latest"
  ADISTS_VERSION: "permalink/latest"
  RUBAR_VERSION: "permalink/latest"

dl-mage8-doc:
  stage: downloads
  tags:
    - linux
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
  script:
    - mkdir -p doc
    - cd doc
    - curl -L -o mage8.pdf https://forge.inrae.fr/river-hydraulics/mage/-/releases/$MAGE_8_VERSION/downloads/documents/Mage-8_Documentation.pdf
  artifacts:
    paths:
      - doc/mage8.pdf

dl-mage8-linux:
  stage: downloads
  tags:
    - linux
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
  script:
    - curl -L -o mage8.tgz https://forge.inrae.fr/river-hydraulics/mage/-/releases/$MAGE_8_VERSION/downloads/packages/mage_linux.tgz
    - mkdir -p mage8-linux
    - cd mage8-linux
    - tar xvf ../mage8.tgz
  artifacts:
    paths:
      - mage8-linux/mage

dl-mage8-windows:
  stage: downloads
  tags:
    - linux
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
  script:
    - curl -L -o mage8.tgz https://forge.inrae.fr/river-hydraulics/mage/-/releases/$MAGE_8_VERSION/downloads/packages/mage_windows.tgz
    - mkdir -p mage8-windows
    - cd mage8-windows
    - tar xvf ../mage8.tgz
  artifacts:
    paths:
      - mage8-windows/mage.exe

dl-adists-linux:
  stage: downloads
  tags:
    - linux
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
  script:
    - mkdir -p adists-linux
    - cd adists-linux
    - curl -L -o adists https://forge.inrae.fr/river-hydraulics/adists/-/releases/$ADISTS_VERSION/downloads/executables/adists
  artifacts:
    paths:
      - adists-linux/adists

dl-adists-windows:
  stage: downloads
  tags:
    - linux
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
  script:
    - mkdir -p adists-windows
    - cd adists-windows
    - curl -L -o adists.exe https://forge.inrae.fr/river-hydraulics/adists/-/releases/$ADISTS_VERSION/downloads/executables/adists_win64.exe
  artifacts:
    paths:
      - adists-windows/adists.exe

dl-rubar-linux:
  stage: downloads
  tags:
    - linux
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
  script:
    - mkdir -p rubar-linux
    - cd rubar-linux
    - curl -L -o rubar.tgz https://forge.inrae.fr/river-hydraulics/rubarbe/-/releases/$RUBAR_VERSION/downloads/packages/rubar_linux.tgz
    - tar xf rubar.tgz
  artifacts:
    paths:
      - rubar-linux/rubarbe

dl-rubar-windows:
  stage: downloads
  tags:
    - linux
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
  script:
    - mkdir -p rubar-windows
    - cd rubar-windows
    - curl -L -o rubar.tgz https://forge.inrae.fr/river-hydraulics/rubarbe/-/releases/$RUBAR_VERSION/downloads/packages/rubar_windows.tgz
    - tar xf rubar.tgz
  artifacts:
    paths:
      - rubar-windows/rubarbe.exe

#############
# CONFIGURE #
#############

set-version:
  stage: configure
  tags:
    - linux
  script:
    - cd packages
    - ./version.sh "$CI_COMMIT_BRANCH" "$CI_COMMIT_TAG" "$CI_COMMIT_SHORT_SHA"
  artifacts:
    paths:
      - VERSION

build-lang:
  stage: configure
  tags:
    - linux
  script:
    - cd ./src/lang/
    - ./create_ts.sh
  artifacts:
    paths:
      - src/lang/*.qm

#########
# TESTS #
#########

unittest:
  stage: test
  tags:
    - linux
  needs:
    - job: set-version
      artifacts: true
  script:
    - python3.12 -m venv venv
    - . venv/bin/activate
    - pip3 install -U pip
    - pip3 install -r ./full-requirements.txt
    - pip3 install -U -r ./full-requirements.txt
    - cd src
    - python3.12 -m unittest discover -t .

test-pep8:
  stage: test
  tags:
    - linux
  needs:
    - job: set-version
      artifacts: true
    - job: unittest
  script:
    # Setup virtual env
    - python3.12 -m venv venv
    - . venv/bin/activate
    - pip3 install -U pip
    - pip3 install -r ./requirements.txt
    - pip3 install -U -r ./requirements.txt
    - pip3 install pycodestyle
    - pycodestyle --exclude="*_to_*.py" ./src
  allow_failure: true

#########
# BUILD #
#########

# build-users-doc:
#   stage: build
#   tags:
#     - linux
#   needs:
#     - job: set-version
#       artifacts: true
#   script:
#     - cd ./doc/users/
#     - ./build.sh
#   artifacts:
#     paths:
#       - doc/users/documentation.pdf
#       - doc/users/documentation.html
#       - doc/users/images/
#   allow_failure: true

build-td:
  stage: build
  tags:
    - linux
  needs:
    - job: set-version
      artifacts: true
  script:
    - cd ./doc/users/TP_Hydraulique_Hogneau/
    - ./build.sh
  artifacts:
    paths:
      - doc/users/TP_Hydraulique_Hogneau/step-by-step.pdf
      - doc/users/TP_Hydraulique_Hogneau/pas-a-pas.pdf
      - doc/users/TP_Hydraulique_Hogneau/Tuto-2-fr.pdf
      - doc/users/TP_Hydraulique_Hogneau/data/
  allow_failure: true

build-td-2:
  stage: build
  tags:
    - linux
  needs:
    - job: set-version
      artifacts: true
  script:
    - cd ./doc/users/TP_AdisTS_Vieux_Rhone/
    - ./build.sh
  artifacts:
    paths:
      - doc/users/TP_AdisTS_Vieux_Rhone/pas-a-pas.pdf
      - doc/users/TP_AdisTS_Vieux_Rhone/data/
      - doc/users/TP_AdisTS_Vieux_Rhone/Sujet.pdf
      - doc/users/TP_AdisTS_Vieux_Rhone/Vieux_Rhone_TP_AdisTS.pamhyr
  allow_failure: true

build-developers-doc:
  stage: build
  tags:
    - linux
  needs:
    - job: set-version
      artifacts: true
  script:
    - cd ./doc/dev/
    - ./build.sh
    # Create html documentation
    - cd ../../src
    - python3.12 -m venv doc-venv
    - . doc-venv/bin/activate
    - pip3 install -U pip
    - pip3 install -r ../full-requirements.txt
    - pip3 install -U -r ../full-requirements.txt
    - pip3 install pdoc3
    - pdoc --html .
    # Create archive
    - tar cf html.tar ./html
    - cd ../doc/dev
    - mv ../../src/html.tar ./
  artifacts:
    paths:
      - doc/dev/documentation.pdf
      - doc/dev/documentation.html
      - doc/dev/html.tar
      - doc/dev/images/
  allow_failure: true

build-linux:
  stage: build
  tags:
    - linux
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
  needs:
    - job: dl-adists-linux
      artifacts: true
    - job: dl-rubar-linux
      artifacts: true
    - job: dl-mage8-linux
      artifacts: true
    - job: dl-mage8-doc
      artifacts: true
    - job: set-version
      artifacts: true
    - job: build-lang
      artifacts: true
    - job: build-developers-doc
      artifacts: true
    # - job: build-users-doc
    #   artifacts: true
    - job: build-td
      artifacts: true
    - job: build-td-2
      artifacts: true
  script:
    - mkdir -p linux
    - cd linux
    # Setup virtual env
    - python3.12 -m venv linux-venv
    - . linux-venv/bin/activate
    - pip3 install -U pip
    - pip3 install -r ../requirements.txt
    - pip3 install -U -r ../requirements.txt
    # Run Pyinstaller
    - pyinstaller -y $HIDDEN_IMPORTS --paths linux-venv/lib/python3.12/site-packages ../src/pamhyr.py
    # Create directory
    - mkdir -p pamhyr
    - mkdir -p pamhyr/_internal
    # Copy Pamhyr info
    - cp -v ../VERSION pamhyr/_internal/
    - cp -v ../AUTHORS pamhyr/_internal/
    - cp -v ../LICENSE pamhyr/_internal/
    - cp -v ../src/motd.txt pamhyr/_internal/
    # Copy mage
    - mkdir -p pamhyr/mage8
    - cp -v ../mage8-linux/* pamhyr/mage8/
    # Copy adists
    - mkdir -p pamhyr/adists
    - cp -v ../adists-linux/* pamhyr/adists/
    # Copy rubar
    - mkdir -p pamhyr/rubar
    - cp -v ../rubar-linux/* pamhyr/rubar/
    # Copy Pamhyr
    - cp -r dist/pamhyr/* pamhyr/
    # Pamhyr script to force x11
    - echo '#!/usr/bin/env bash' > pamhyr/pamhyr-x11
    - echo "" >> pamhyr/pamhyr-x11
    - echo "GDK_BACKEND=x11 ./pamhyr $@" >> pamhyr/pamhyr-x11
    - chmod +x pamhyr/pamhyr-x11
    # Copy Pamhyr resources
    - mkdir -p pamhyr/_internal/View
    - mkdir -p pamhyr/_internal/View/ui
    - mkdir -p pamhyr/_internal/View/ui/Widgets
    - cp -r ../src/View/ui/*.ui pamhyr/_internal/View/ui/
    - cp -r ../src/View/ui/ressources/ pamhyr/_internal/View/ui
    - cp -r ../src/View/ui/Widgets/*.ui pamhyr/_internal/View/ui/Widgets
    # Copy lang
    - mkdir -p pamhyr/_internal/lang
    - cp -r ../src/lang/*.qm pamhyr/_internal/lang
    # Copy tests cases
    - mkdir -p pamhyr/tests_cases/
    - mkdir -p pamhyr/tests_cases/Saar
    - cp ../tests_cases/Saar/Saar.pamhyr pamhyr/tests_cases/Saar/
    # Copy documentations
    - mkdir -p pamhyr/doc/
    - mkdir -p pamhyr/doc/images/
    - mkdir -p pamhyr/doc/html/
    # - cp ../doc/users/documentation.pdf pamhyr/doc/Pamhyr2-users.pdf
    # - cp ../doc/users/documentation.html pamhyr/doc/Pamhyr2-users.html
    - cp ../doc/mage8.pdf pamhyr/doc/mage8.pdf
    - cp ../doc/dev/documentation.pdf pamhyr/doc/Pamhyr2-dev.pdf
    - cp ../doc/dev/documentation.html pamhyr/doc/Pamhyr2-dev.html
    #- cp ../doc/users/images/* pamhyr/doc/images
    - cp -r ../doc/dev/images/* pamhyr/doc/images
    - cp -r ../doc/images/* pamhyr/doc/images
    # Copy Tuto
    - mkdir -p pamhyr/doc/TP_Hydraulique_Hogneau/
    - mkdir -p pamhyr/doc/TP_Hydraulique_Hogneau/data
    - cp ../doc/users/TP_Hydraulique_Hogneau/Hogneau_Engees2022.pdf pamhyr/doc/TP_Hydraulique_Hogneau/Hogneau_Engees2022.pdf
    - cp ../doc/users/TP_Hydraulique_Hogneau/step-by-step.pdf pamhyr/doc/TP_Hydraulique_Hogneau/Tuto1-en.pdf
    - cp ../doc/users/TP_Hydraulique_Hogneau/pas-a-pas.pdf pamhyr/doc/TP_Hydraulique_Hogneau/Tuto1-fr.pdf
    - cp ../doc/users/TP_Hydraulique_Hogneau/Tuto-2-fr.pdf pamhyr/doc/TP_Hydraulique_Hogneau/Tuto2-fr.pdf
    - cp ../doc/users/TP_Hydraulique_Hogneau/*.pamhyr pamhyr/doc/TP_Hydraulique_Hogneau/
    - cp ../doc/users/TP_Hydraulique_Hogneau/data/* pamhyr/doc/TP_Hydraulique_Hogneau/data/
    - mkdir -p pamhyr/doc/TP_AdisTS_Vieux_Rhone/
    - mkdir -p pamhyr/doc/TP_AdisTS_Vieux_Rhone/data
    - cp ../doc/users/TP_AdisTS_Vieux_Rhone/*.pdf pamhyr/doc/TP_AdisTS_Vieux_Rhone/
    - cp ../doc/users/TP_AdisTS_Vieux_Rhone/data/* pamhyr/doc/TP_AdisTS_Vieux_Rhone/data/
    - cp ../doc/users/TP_AdisTS_Vieux_Rhone/Vieux_Rhone_TP_AdisTS.pamhyr pamhyr/doc/TP_AdisTS_Vieux_Rhone/Vieux_Rhone_TP_AdisTS.pamhyr
    # Copy TP charriage
    - mkdir -p pamhyr/doc/TP_charriage/
    - cp -r ../doc/users/TP_charriage/* pamhyr/doc/TP_charriage
  artifacts:
    paths:
      - linux/pamhyr

build-windows:
  stage: build
  tags:
    - wine
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
  needs:
    - job: dl-mage8-windows
      artifacts: true
    - job: dl-adists-windows
      artifacts: true
    - job: dl-rubar-windows
      artifacts: true
    - job: dl-mage8-doc
      artifacts: true
    - job: set-version
      artifacts: true
    - job: build-lang
      artifacts: true
    - job: build-developers-doc
      artifacts: true
    # - job: build-users-doc
    #   artifacts: true
    - job: build-td
      artifacts: true
    - job: build-td-2
      artifacts: true
  script:
    - mkdir windows
    - cd windows
    # Setup env
    - python -m pip install -U pip
    - python -m pip install -r ..\requirements.txt
    - python -m pip install -U -r ..\requirements.txt
    # Run Pyinstaller
    # - pyinstaller --noconsole -y ..\src\pamhyr.py
    - pyinstaller -i ../src/View/ui/ressources/icon.ico $HIDDEN_IMPORTS --hide-console hide-early -y ..\src\pamhyr.py
    # Create directory
    - mkdir pamhyr
    - dir
    - copy ..\packages\make-windows-dir.bat .\make-windows-dir.bat
    - .\make-windows-dir.bat
  artifacts:
    paths:
      - windows/pamhyr

############
# PACKAGES #
############

linux-package-tar:
  stage: package
  tags:
    - release
    - linux
  needs:
    # - job: test-linux
    - job: build-linux
      artifacts: true
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_TAG
  artifacts:
    paths:
      - linux/pamhyr-gnulinux.tar.xz
  script:
    - cd linux
    - tar --xz -cf pamhyr-gnulinux.tar.xz ./pamhyr --checkpoint=.100

windows-package-zip:
  stage: package
  tags:
    - release
    - linux
  needs:
    # - job: test-windows
    - job: build-windows
      artifacts: true
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_TAG
  artifacts:
    paths:
      - windows/pamhyr-windows.zip
  script:
    - cd windows
    - zip -r pamhyr-windows.zip pamhyr

windows-package-exe:
  stage: package
  tags:
    - release
    - wine
  needs:
    # - job: test-windows
    - job: build-windows
      artifacts: true
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_TAG
  artifacts:
    paths:
      - windows/pamhyr-windows.exe
  script:
    - cd windows
    - copy ..\packages\make-windows-exe.bat make-windows-exe.bat
    - copy ..\packages\pamhyr.nsi pamhyr.nsi
    - .\make-windows-exe.bat

########
# HASH #
########

linux-build-hash:
  stage: hash
  tags:
    - release
    - linux
  needs:
    - job: build-linux
      artifacts: true
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
  script:
    - cd linux
    - sha256sum -b pamhyr/pamhyr > pamhyr/pamhyr.sha256
  artifacts:
    paths:
      - linux/pamhyr/pamhyr.sha256

windows-build-hash:
  stage: hash
  tags:
    - release
    - linux
  needs:
    - job: build-windows
      artifacts: true
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
  script:
    - cd windows
    - sha256sum -b pamhyr/pamhyr.exe > pamhyr/pamhyr.exe.sha256
  artifacts:
    paths:
      - windows/pamhyr/pamhyr.exe.sha256

pkg-hash:
  stage: hash
  tags:
    - release
    - linux
  needs:
    - job: linux-package-tar
      artifacts: true
    - job: windows-package-zip
      artifacts: true
    - job: windows-package-exe
      artifacts: true
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_TAG
  script:
    - cd windows
    - sha256sum -b pamhyr-windows.exe > pamhyr-windows.exe.sha256
    - sha256sum -b pamhyr-windows.zip > pamhyr-windows.zip.sha256
    - cd ..
    - cd linux
    - sha256sum -b pamhyr-gnulinux.tar.xz > pamhyr-gnulinux.tar.xz.sha256
  artifacts:
    paths:
    - windows/pamhyr-windows.exe.sha256
    - windows/pamhyr-windows.zip.sha256
    - linux/pamhyr-gnulinux.tar.xz.sha256

#############
# ANTIVIRUS #
#############

build-check-clamav:
  stage: antivirus
  tags:
    - release
    - linux
  needs:
    - job: build-linux
      artifacts: true
    - job: build-windows
      artifacts: true
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
  script:
    - cd packages
    - ./clamav-scan.sh builds
  allow_failure: true

pkg-check-clamav:
  stage: antivirus
  tags:
    - release
    - linux
  needs:
    - job: linux-package-tar
      artifacts: true
    - job: windows-package-zip
      artifacts: true
    - job: windows-package-exe
      artifacts: true
  rules:
    - if: $CI_COMMIT_BRANCH == 'ci-test' || $CI_COMMIT_TAG
  script:
    - cd packages
    - ./clamav-scan.sh packages
  allow_failure: true

###########
# RELEASE #
###########

shadow-release:
  stage: release
  tags:
    - release
    - linux
  needs:
    - job: linux-package-tar
      artifacts: true
    - job: windows-package-zip
      artifacts: true
    - job: windows-package-exe
      artifacts: true
    # - job: build-users-doc
    #   artifacts: true
    - job: build-developers-doc
      artifacts: true
    - job: pkg-hash
      artifacts: true
  rules:
    - if: $CI_COMMIT_TAG && $CI_COMMIT_TAG !~ /^v/
  artifacts:
    paths:
      - linux/pamhyr-gnulinux.tar.xz
      - windows/pamhyr-windows.zip
      - windows/pamhyr-windows.exe
      - linux/pamhyr-gnulinux.tar.xz.sha256
      - windows/pamhyr-windows.zip.sha256
      - windows/pamhyr-windows.exe.sha256
      - doc/dev/documentation.pdf
      # - doc/users/documentation.pdf
  script:
    - cd packages


tag-release:
  stage: release
  tags:
    - release
    - linux
  needs:
    - job: linux-package-tar
      artifacts: true
    - job: windows-package-zip
      artifacts: true
    - job: windows-package-exe
      artifacts: true
    # - job: build-users-doc
    #   artifacts: true
    - job: build-developers-doc
      artifacts: true
    - job: pkg-hash
      artifacts: true
  rules:
    - if: $CI_COMMIT_TAG =~ /^v/
  artifacts:
    paths:
      - linux/pamhyr-gnulinux.tar.xz
      - windows/pamhyr-windows.zip
      - windows/pamhyr-windows.exe
      - linux/pamhyr-gnulinux.tar.xz.sha256
      - windows/pamhyr-windows.zip.sha256
      - windows/pamhyr-windows.exe.sha256
      - doc/dev/documentation.pdf
      # - doc/users/documentation.pdf
  script:
    - cd packages
  release:
    name: '$CI_COMMIT_TAG'
    description: '$CI_COMMIT_TAG_MESSAGE'
    tag_name: '$CI_COMMIT_TAG'
    ref: '$CI_COMMIT_SHA'
    assets:
      links:
        - name: 'GNU/Linux CHECKSUM SHA256 (tar.xz)'
          url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/linux/pamhyr-gnulinux.tar.xz.sha256'
          filepath: '/linux/pamhyr-gnulinux.tar.xz.sha256'
          link_type: 'package'
        - name: 'GNU/Linux (tar.xz)'
          url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/linux/pamhyr-gnulinux.tar.xz'
          filepath: '/linux/pamhyr-gnulinux.tar.xz'
          link_type: 'package'
        - name: 'Windows CHECKSUM SHA256 (exe)'
          url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/windows/pamhyr-windows.exe.sha256'
          filepath: '/windows/pamhyr-windows.exe.sha256'
          link_type: 'package'
        - name: 'Windows (exe)'
          url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/windows/pamhyr-windows.exe'
          filepath: '/windows/pamhyr-windows.exe'
          link_type: 'package'
        - name: 'Windows CHECKSUM SHA256 (zip)'
          url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/windows/pamhyr-windows.zip.sha256'
          filepath: '/windows/pamhyr-windows.zip.sha256'
          link_type: 'package'
        - name: 'Windows (zip)'
          url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/windows/pamhyr-windows.zip'
          filepath: '/windows/pamhyr-windows.zip'
          link_type: 'package'
        - name: 'Dev documentations (pdf)'
          url: '${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/doc/dev/documentation.pdf'
          filepath: '/doc/dev/documentation.pdf'
          link_type: 'other'
