/**
 * ZDDC Archive - Initialization
 * Sets up window.app and window.app.modules before other modules run.
 * Must be the first JS file in the build.
 */
(function() {
    'use strict';

    window.app = {
        sourceMode: null,
        directories: [],
        groupingFolders: [],
        transmittalFolders: [],
        files: [],
        filteredFiles: [],
        selectedFiles: new Set(),
        isScanning: false,
        scanProgress: '',

        columnFilters: { trackingNumber: '', title: '', revisions: '' },
        columnFilterASTs: { trackingNumber: null, title: null, revisions: null },
        groupingFilter: '',
        transmittalFilter: '',
        enabledFolderTypes: new Set(['issued', 'received']),
        sortField: 'trackingNumber',
        sortDirection: 'asc',
        selectedGroupingFolders: new Set(),
        selectedTransmittalFolders: new Set(),
        collapsedDateGroups: new Set(),
        collapsedGroupingFolders: new Set(),
        selectAllGroupingFolders: true,
        selectAllTransmittals: true,
        availableModifiers: new Set(),
        selectedModifiers: new Set(),
        showSelectedOnly: false,
        projectFilter: new Set(),     // URL-derived; controls what gets SCANNED
        visibleProjects: new Set(),   // dropdown-derived; controls VISIBILITY of already-scanned data
        availableProjects: [],        // populated by autoConnectHttpSource from server's ProjectInfo[]
        isMultiProject: false,        // true when ?projects= is set OR server returns ProjectInfo
        FOLDER_TYPE_NAMES: ['issued', 'received', 'mdl', 'incoming'],
        ARCHIVE_STAGE_NAME: 'archive',
        modules: {}
    };

})();
