{
    "OrthancExplorer2" : {
        // enables or disables the plugin completely
        "Enable": true,

        // Prefix URL of the OE2 application (and API)
        // A value of '/my-ui' means that the app will be available under /my-ui/app/
        // and the api will be available under /my-ui/api/...
        // Should start and end with a '/'
        "Root" : "/ui/",

        // Whether OE2 shall replace the default Orthanc Explorer interface ('/' URL will redirect to OE2)
        "IsDefaultOrthancUI": true,

        // Base theme for the UI (before custom CSS are applied).
        // Allowed values: "light", "dark"
        "Theme": "light",

        // Path to custom CSS file or logo.
        // The custom CSS are applied after these default files and they are loaded after all other CSS.  
        // You may actually override any CSS value or variable from the application. 
        //   - https://github.com/orthanc-server/orthanc-explorer-2/blob/master/WebApplication/src/assets/css/defaults-dark.css
        //   - https://github.com/orthanc-server/orthanc-explorer-2/blob/master/WebApplication/src/assets/css/defaults-light.css
        // "CustomCssPath": "/home/my/path/to/custom.css",
        // "CustomLogoUrl": "https://my.company/logo.png",
        // "CustomLogoPath": "/home/my/path/to/logo.png",
        // "CustomFavIconPath": "/home/my/path/to/favicon.ico",     // note: this can be a .png, .svg or .ico file
        
        // Custom Window/Tab Title
        // "CustomTitle": "Orthanc Explorer 2",

        // This block of configuration is transmitted as is to the frontend application.
        // Make sure not to store any secret here
        "UiOptions" : {
            // note: all the "Enable..." variables can be set to false by the user-profile (if using the authorization plugin)

            "EnableStudyList": true,                    // Enables the access to the study list (TODO)
            "EnableUpload": true,                       // Enables the upload menu/interface
            "EnableDicomModalities": true,              // Enables the 'DICOM Modalities' interface in the side menu
            "EnableDeleteResources": true,              // Enables the delete button for Studies/Series/Instances
            "EnableDownloadZip": true,                  // Enables the download zip button for Studies/Series
            "EnableDownloadDicomDir": false,            // Enables the download DICOM DIR button for Studies/Series
            "EnableDownloadDicomFile": true,            // Enables the download DICOM file button for Instances
            "EnableAnonymization": true,                // Enables the anonymize button
            "EnableModification": true,                 // Enables the modify button
            "EnableSendTo": true,                       // Enables the 'SendTo' button for Studies/Series/Instances
            "EnableApiViewMenu": false,                 // Enables the API button to open API routes for Studies/Series/Instances (developer mode) 
            "EnableSettings": true,                     // Enables the settings menu/interface
            "EnableLinkToLegacyUi": true,               // Enables a link to the legacy Orthanc UI
            "EnableChangePassword": true,               // Enables the 'change password' button in the side bar.  Only applicable if Keycloak is enabled
            "EnableViewerQuickButton": true,            // Enables a button in the study list to directly open a viewer
            "EnableReportQuickButton": false,           // Enables a button in the study list to directly open a PDF report if available in the study

            "EnableEditLabels": true,                   // Enables labels management (create/delete/assign/unassign)
            "AvailableLabels": [],                      // If not empty, this list prevents the creation of new labels and only allows add/remove of the listed labels.
                                                        // This configuration may be overriden when you use Keycloak and an auth-service that implements roles/permissions API.
            "EnableLabelsCount": true,                  // Enables display of study count next to the each label (this might slow down the UI)

            "EnableShares": false,                      // Enables sharing studies.  See "Tokens" section below.
            "DefaultShareDuration": 0,                  // [in days].  0 means no expiration date, 
            "ShareDurations": [0, 7, 15, 30, 90, 365],  // The share durations proposed in the UI

            "EnableAddSeries": true,                    // Enables the "Add series" button
            "AddSeriesDefaultTags": {                   // Default tag values when adding a new series of each type ("pdf", "image" or "stl")
                "pdf" : {
                    "SeriesDescription": "Report",
                    "Modality": "DOC",
                    "SeriesDate": "$TODAY$"             // Allowed keywords: $TODAY$, $STUDY_DATE$, $FILE_DATE$
                },
                "image" : {
                    "SeriesDescription": "Picture",
                    "Modality": "XC",
                    "SeriesDate": "$TODAY$"
                },
                "stl" : {
                    "SeriesDescription": "Model",
                    "Modality": "M3D",
                    "SeriesDate": "$TODAY$"
                }
            },
			
			"EnabledMammographyPlugin": false,

            // If both OHIF viewer configurations are enabled, only the v3 is taken into account
            "EnableOpenInOhifViewer": false,            // Enables a "open in OHIF viewer" button.  Note: OHIF can not be used together with KeyCloak (https://community.ohif.org/t/ohif-orthanc-token-to-access-a-single-study/727)
            "OhifViewerPublicRoot" : "http://to-be-defined/",  // must end with a '/'.  e.g: "http://ohif.my.site/" means that link to OHIF will look like http://ohif.my.site/Viewer/1.2.3.444.5555....
            "EnableOpenInOhifViewer3": false,           // Enables a "open in OHIF viewer" button.  If the OHIF plugin is loaded, the default value is 'true'
            "OhifViewer3PublicRoot" : "/ohif/",         // must end with a '/'.  e.g: "http://ohif.my.site/" means that link to OHIF will look like http://ohif.my.site/viewer?StudyInstanceUIDs=1.2.3.444.5555....

            "EnableOpenInMedDreamViewer": false,        // Enables a "open in MedDream viewer" button
            "MedDreamViewerPublicRoot" : "http://to-be-defined/",  // must end with a '/'.  e.g: "http://meddream.my.site/Viewer/" means that link to MedDream will look like http://meddream.my.site/?study=1.2.3.444.5555....

            // Defines which icons is used by which enabled viewer.
            // Allowed keys: "meddream", "osimis-web-viewer", "stone-webviewer", "ohif", "ohif-vr", "ohif-tmtv"
            // Allowed values: CSS class that defines the viewer icons (only from bootstrap icons)
            "ViewersIcons" : {
                "osimis-web-viewer": "bi bi-eye",
                "stone-webviewer": "bi bi-eye-fill",
                "ohif": "bi bi-grid",
                "ohif-vr": "bi bi-grid-1x2",
                "ohif-tmtv": "bi bi-grid-3x3-gap",
                "ohif-seg": "fa-solid fa-shapes fa-button",
                "ohif-micro": "fa-solid fa-microscope fa-button",
                "meddream": "bi bi-columns-gap",
                "volview": "bi bi-box",
                "wsi": "fa-solid fa-microscope fa-button"
            },
            // Defines the order in which the viewer icons should appear in the interface
            // OHIF viewers modes that are not listed here, won't appear in the interface.
            "ViewersOrdering" : [
                // "osimis-web-viewer",  // now deprecated
                "stone-webviewer",
                "ohif",
                "ohif-vr",
                "ohif-tmtv",
                "ohif-seg",
                // "ohif-micro", // currently disabled, this is still experimental in OHIF
                "meddream",
                "volview",
                "wsi"
            ],

            "MaxStudiesDisplayed": 100,                 // The maximum number of studies displayed in the study list.
                                                        // From v 1.7.0, this option is not used anymore in the local study list when using 
                                                        // a DB backend that supports ExtendedFind (SQLite and PostgreSQL)
                                                        // but is still used in the DicomWeb queries.
            "PageLoadSize": 50,                         // The number of items that are loaded when scrolling the study or instance list.
                                                        // Only applicable with a DB backend that supports ExtendedFind.
            
                                                        "MaxMyJobsHistorySize": 5,                  // The maximum number of jobs appearing under 'my jobs' in side bar (0 = unlimited)

            "StudyListSearchMode": "search-as-you-type",// mode to trigger a search in the StudyList.  Accepted values: 'search-as-you-type' or 'search-button'
            "StudyListSearchAsYouTypeMinChars": 3,      // minimum number of characters to enter in a text search field before it starts searching the DB
            "StudyListSearchAsYouTypeDelay": 400,       // Delay [ms] between the last key stroke and the trigger of the search
            "StudyListContentIfNoSearch": "most-recents", // Defines what to show if no search criteria has been entered
                                                          // Allowed values: "empty", "most-recents"
                                                          // From v 1.7.0, this option is always considered as "most-recents" when using 
                                                          // a DB backend that supports ExtendedFind (SQLite and PostgreSQL)

            // Default settings are ok for "small" Orthanc Databases.  For large databases, it is recommended to use these settings:
            // "StudyListSearchMode": "search-button"
            // "StudyListContentIfNoSearch": "empty"

            "ShowOrthancName": true,                    // display the Orthanc Name in the side menu
            
            // The list of tags to be displayed in the upload dialog result list
            // (the first N defined tags in the list are displayed on the UI)
            // Allowed values are: "StudyDate", "AccessionNumber", "PatientID",
            // "PatientName", "PatientBirthDate", "StudyDescription"
            "UploadReportTags" : [                      
                "PatientName", 
                "StudyDescription",
                "PatientID",
                "AccessionNumber", 
                "StudyDate" 
            ],
            "UploadReportMaxTags" : 2,                  // See above, the max number of tags displayed in the upload report

            // The ordered list of columns to display in the study list.
            // Allowed values are:
            //  - Dicom Tags: "StudyDate", "AccessionNumber", "PatientID"
            //                "PatientName", "PatientBirthDate", "StudyDescription"
            //  - special columns:
            //    - "modalities": the list of modalities in the study
            //    - "seriesCount": the number of series in the study
            //    - "instancesCount": the number of instances in the study
            //    - "seriesAndInstancesCount": a combined value with the number of series/instances in the study
            "StudyListColumns" : [
                "PatientBirthDate",
                "PatientName",
                "PatientID",
                "StudyDescription",
                "StudyDate",
                "modalities",
                "AccessionNumber",
                "seriesAndInstancesCount"
            ],

            // The list of patient level tags that are displayed in the study details and in the modification dialog.
            // Note that these tags must be defined in the Orthanc main dicom tags (https://orthanc.uclouvain.be/book/faq/main-dicom-tags.html)
            "PatientMainTags" : [
                "PatientID",
                "PatientName",
                "PatientBirthDate",
                "PatientSex",
                "OtherPatientIDs"
            ],

            // The list of study level tags that are displayed in the study details and in the modification dialog.
            // Note that these tags must be defined in the Orthanc main dicom tags (https://orthanc.uclouvain.be/book/faq/main-dicom-tags.html)
            "StudyMainTags" : [
                "StudyDate",
                "StudyTime",
                "StudyDescription",
                "AccessionNumber",
                "StudyID",
                "StudyInstanceUID",
                "RequestingPhysician",
                "ReferringPhysicianName",
                "InstitutionName"
            ],

            // The list of series level tags that are displayed in the study details and in the modification dialog.
            // Note that these tags must be defined in the Orthanc main dicom tags (https://orthanc.uclouvain.be/book/faq/main-dicom-tags.html)
            "SeriesMainTags" : [
                "SeriesDate",
                "SeriesTime",
                "SeriesDescription",
                "SeriesNumber",
                "BodyPartExamined",
                "ProtocolName",
                "SeriesInstanceUID"
            ],

            // The modalities to display in the Modalities filter dropdown in the Study List
            "ModalitiesFilter": [
                "CR", "CT", "DOC", "DR", "DX", "KO", "MG", "MR", "NM", "OT", "PR", "PT", "PX", "RTDOSE", "RTSTRUCT", "RTPLAN", "SEG", "SR", "US", "XA", "XC"
            ],

            // Defines the list of languages available in the language picker
            // ex: "AvailableLanguages" : ["en", "fr"],
            // ex: "AvailableLanguages" : []  -> this won't show the language picker at all and force usage of the DefaultLanguage
            "AvailableLanguages": ["en", "de", "es", "fr", "it", "ka", "ru", "si", "uk", "zh"],
            
            // Force the default language.  If null (default), the language is the language from the visitor's browser.
            // ex: "DefaultLanguage" : "en"
            "DefaultLanguage" : null,

            // Should DicomTags be translated (true) or shall we use the English symbolic name whatever the selected language (false)
            // if true: "PatientID" is displayed as e.g "ID Patient" in french
            // if false: "PatientID" is displayed as "PatientID" in all languages
            "TranslateDicomTags" : true,

            // Display format for dates in the study list based on these definitions: https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
            // example: "dd/MM/yyyy" for European Format,
            //          "yyyyMMdd" for DICOM format
            "DateFormat": "yyyyMMdd",

            // PatientName transformation for display.  This requires a Regex for capturing and one expression for formatting.
            // If PatientNameFormatting is not defined, no transformation occurs (this is the default behaviour).
            // The Regex is a Javascript regex and is applied this way:
            // FormattedName = PatientName.replace(new RegExp(PatientNameCapture), PatientNameFormatting);
            // in example, to capture carets separated names and re-order them, one would use:
            // FormattedName = PatientName.replace(new RegExp("([^\\^]+)\\^?([^\\^]+)?\\^?([^\\^]+)?\\^?([^\\^]+)?\\^?([^\\^]+)?"), '$1 $3 $2');
            "PatientNameCapture" : "([^\\^]+)\\^?([^\\^]+)?\\^?([^\\^]+)?\\^?([^\\^]+)?\\^?([^\\^]+)?",
            // "PatientNameFormatting": "$1 $3 $2"

            // modifications dialog options
            "Modifications": {
                // Modes define options to the /modify route:
                // "modify-keep-uids" is equivalent to KeepSource=True and Keep=["StudyInstanceUID", "SeriesInstanceUID", "SOPInstanceUID"]
                // "modify-new-uids" is equivalent to KeepSource=False
                // "duplicate" is equivalent to KeepSource=True
                // "AllowedModes" and "DefaultMode" apply to studies modification
                "AllowedModes": ["modify-new-uids", "modify-keep-uids", "duplicate"],
                "DefaultMode": "modify-new-uids",

                // same configurations for Series (introduced in 1.2.0)
                "SeriesAllowedModes": ["modify-new-uids", "modify-keep-uids", "duplicate"],
                "SeriesDefaultMode": "modify-new-uids"

            },

            // List of tags that are used to identify studies belonging to the same patient.
            // This appears as "This patient has {count} studies in total" in the study details.
            // ex: "ShowSamePatientStudiesFilter" : ["PatientID", "PatientBirthDate", "PatientSex"]
            "ShowSamePatientStudiesFilter" : [
                "PatientID"
            ]
        },

        "Shares" : {
            "TokenService" : {
                "Url": "http://change-me:8000/shares",
                "Username": "change-me",
                "Password": "change-me"
            },
            "Type": "osimis-viewer-publication" // allowed values: "osimis-viewer-publication", "meddream-viewer-publication", "stone-viewer-publication"
        },

        // When using Keycloak for user management
        "Keycloak" : {
            "Enable": false,
            "Url": "http://change-me:8080/",
            "Realm": "change-me",
            "ClientId": "change-me"
        },

        
        // this section is only relevant if the authorization plugin is enabled and user-profile based permissions are implemented
        "Tokens" : {
            "InstantLinksValidity": 200,                // the duration, in seconds an 'instant' token is valid (e.g. used to download a study, open a study in a viewer)
            "ShareType": "stone-viewer-publication"     // allowed values: "stone-viewer-publication", "osimis-viewer-publication", "meddream-viewer-publication"
            //"RequiredForLinks": false                 // experimental, set it to false when using basic-auth together with the auth-plugin (https://discourse.orthanc-server.org/t/user-based-access-control-with-label-based-resource-access/5454)
        }
    }
}