<?php

return [
    'backup' => [
        'name' => env('APP_NAME', 'spk-saw'), // Ganti dengan nama aplikasi Anda

        'source' => [
            'files' => [
                'include' => [
                    base_path('.env'),
                    base_path('app/'),
                    base_path('config/'),
                    base_path('database/'),
                    base_path('resources/'),
                    base_path('routes/'),
                ],
                'exclude' => [
                    base_path('vendor'),
                    base_path('node_modules'),
                    base_path('storage'),
                    base_path('tests'),
                ],
                'follow_links' => false,
                'ignore_unreadable_directories' => true,
                'relative_path' => base_path(),
            ],

            'databases' => [
                'mysql' => [
                    'dump' => [
                        'useSingleTransaction' => true,
                        'timeout' => 300, // 5 menit
                        'excludeTables' => [
                            'failed_jobs', // Tabel yang tidak perlu dibackup
                            'password_resets',
                        ],
                    ],
                ],
            ],
        ],

        'destination' => [
            'filename_prefix' => 'spk-saw-backup-', // Sesuaikan
            'disks' => ['local', 'google'], // Tambahkan disk cloud jika perlu
        ],

        'temporary_directory' => storage_path('app/backup-temp'),
        'password' => env('BACKUP_ARCHIVE_PASSWORD', null),
        'encryption' => 'default',
    ],

    'notifications' => [
        'notifications' => [
            \Spatie\Backup\Notifications\Notifications\BackupHasFailedNotification::class => ['mail'],
            \Spatie\Backup\Notifications\Notifications\BackupWasSuccessfulNotification::class => [],
        ],

        'mail' => [
            'to' => env('BACKUP_NOTIFICATION_EMAIL', 'admin@example.com'),
            'from' => [
                'address' => env('MAIL_FROM_ADDRESS', 'no-reply@example.com'),
                'name' => env('MAIL_FROM_NAME', 'SPK-SAW Backup'),
            ],
        ],
    ],

    'monitor_backups' => [
        [
            'name' => env('APP_NAME', 'spk-saw'),
            'disks' => ['local'],
            'health_checks' => [
                \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
                \Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 1000,
            ],
        ],
    ],

    'cleanup' => [
        'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class,
        'default_strategy' => [
            'keep_all_backups_for_days' => 7,
            'keep_daily_backups_for_days' => 16,
            'keep_weekly_backups_for_weeks' => 4,
            'keep_monthly_backups_for_months' => 6,
            'keep_yearly_backups_for_years' => 1,
            'delete_oldest_backups_when_using_more_megabytes_than' => 1000,
        ],
    ],
];