<?php

declare(strict_types=1);

return [
    'disk' => env('ENHANCE_DISK', env('FILESYSTEM_DISK', 'public')),

    'source_prefix' => env('ENHANCE_SOURCE_PREFIX', 'enhance/sources'),
    'output_prefix' => env('ENHANCE_OUTPUT_PREFIX', 'enhance/outputs'),
    'preview_prefix' => env('ENHANCE_PREVIEW_PREFIX', 'enhance/previews'),

    'default_engine' => env('ENHANCE_ENGINE', 'stub'),

    'max_upload_mb' => (int) env('ENHANCE_MAX_UPLOAD_MB', 20),
    'max_input_width' => (int) env('ENHANCE_MAX_INPUT_WIDTH', 4096),
    'max_input_height' => (int) env('ENHANCE_MAX_INPUT_HEIGHT', 4096),
    'max_output_width' => (int) env('ENHANCE_MAX_OUTPUT_WIDTH', 8192),
    'max_output_height' => (int) env('ENHANCE_MAX_OUTPUT_HEIGHT', 8192),

    'allowed_mimes' => [
        'image/jpeg',
        'image/png',
        'image/webp',
    ],

    'allowed_modes' => [
        'standard',
        'artwork',
        'photo',
        'illustration',
    ],

    'allowed_scales' => [2, 4],

    'daily_limit' => (int) env('ENHANCE_DAILY_LIMIT', 10),
    'queue' => env('ENHANCE_QUEUE', 'default'),

    'lifecycle' => [
        'completed_expires_after_days' => (int) env('ENHANCE_COMPLETED_EXPIRES_AFTER_DAYS', 30),
        'failed_expires_after_days' => (int) env('ENHANCE_FAILED_EXPIRES_AFTER_DAYS', 7),
        'deleted_file_grace_days' => (int) env('ENHANCE_DELETED_FILE_GRACE_DAYS', 1),
        'cleanup_chunk_size' => (int) env('ENHANCE_CLEANUP_CHUNK_SIZE', 100),
    ],

    'health' => [
        'stuck_processing_after_minutes' => (int) env('ENHANCE_STUCK_PROCESSING_AFTER_MINUTES', 30),
        'stuck_queued_after_minutes' => (int) env('ENHANCE_STUCK_QUEUED_AFTER_MINUTES', 60),
    ],

    'stub' => [
        'show_warning' => filter_var(env('ENHANCE_STUB_SHOW_WARNING', true), FILTER_VALIDATE_BOOL),
    ],

    'external_worker' => [
        'url' => env('ENHANCE_WORKER_URL'),
        'timeout' => (int) env('ENHANCE_WORKER_TIMEOUT', 300),
        'token' => env('ENHANCE_WORKER_TOKEN'),
        'max_download_mb' => (int) env('ENHANCE_WORKER_MAX_DOWNLOAD_MB', 60),
    ],
];