<?php

    return [
        'name' => 'Lpj',
        'import' => [
            'slik' => [
                // Memory limit untuk import (dalam MB)
                'memory_limit' => env('SLIK_IMPORT_MEMORY_LIMIT', 1024),

                // Ukuran chunk untuk processing (jumlah baris per chunk)
                'chunk_size' => env('SLIK_IMPORT_CHUNK_SIZE', 50),

                // Ukuran batch untuk database insert
                'batch_size' => env('SLIK_IMPORT_BATCH_SIZE', 50),

                // Timeout untuk import (dalam detik)
                'timeout' => env('SLIK_IMPORT_TIMEOUT', 1800), // 30 menit untuk file besar

                // Maksimum file size yang diizinkan (dalam MB)
                'max_file_size' => env('SLIK_IMPORT_MAX_FILE_SIZE', 50),

                // Enable garbage collection untuk optimasi memory
                'enable_gc' => env('SLIK_IMPORT_ENABLE_GC', true),

                // Enable progress logging
                'enable_progress_logging' => env('SLIK_IMPORT_ENABLE_PROGRESS_LOGGING', true),

                // Enable detailed error logging
                'enable_error_logging' => env('SLIK_IMPORT_ENABLE_ERROR_LOGGING', true),

                // XML Scanner settings untuk optimasi memory
                'xml_scanner' => [
                    'timeout' => env('SLIK_XML_SCANNER_TIMEOUT', 1800), // 30 menit
                    'memory_limit' => env('SLIK_XML_SCANNER_MEMORY_LIMIT', 1024), // 1GB
                    'chunk_size' => env('SLIK_XML_SCANNER_CHUNK_SIZE', 50), // Lebih kecil untuk XML
                ],

                // Queue processing untuk file besar
                'queue' => [
                    'enabled' => env('SLIK_IMPORT_QUEUE_ENABLED', false),
                    'connection' => env('SLIK_IMPORT_QUEUE_CONNECTION', 'database'),
                    'queue_name' => env('SLIK_IMPORT_QUEUE_NAME', 'imports'),
                    'chunk_size' => env('SLIK_IMPORT_QUEUE_CHUNK_SIZE', 500),
                ],

                // Progress tracking
                'progress' => [
                    'enabled' => env('SLIK_IMPORT_PROGRESS_ENABLED', true),
                    'update_interval' => env('SLIK_IMPORT_PROGRESS_INTERVAL', 50), // update setiap 50 baris
                    'cache_key' => 'slik_import_progress',
                    'cache_ttl' => 3600, // 1 jam
                ],
            ],

            // General import settings
            'general' => [
                'default_memory_limit' => env('IMPORT_DEFAULT_MEMORY_LIMIT', 128),
                'max_execution_time' => env('IMPORT_MAX_EXECUTION_TIME', 300000),
                'temp_directory' => env('IMPORT_TEMP_DIRECTORY', storage_path('app/temp')),
                'cleanup_temp_files' => env('IMPORT_CLEANUP_TEMP_FILES', true),
            ],
        ],
    ];
