<?php

declare(strict_types=1);

return [

    /*
    |--------------------------------------------------------------------------
    | Disk
    |--------------------------------------------------------------------------
    |
    | Cloudflare R2 in production. Private bucket: nothing here is ever
    | publicly addressable, and reads go through short-lived signed URLs.
    |
    */

    'disk' => env('UPLOADS_DISK', 's3'),

    /*
    |--------------------------------------------------------------------------
    | Kinds
    |--------------------------------------------------------------------------
    |
    | Every upload declares what it is for, and the limits follow from that
    | rather than from one permissive rule covering everything. Constraints
    | are enforced twice: baked into the presigned URL so the bucket rejects a
    | mismatch, and re-checked on confirmation against what actually landed.
    |
    */

    'kinds' => [

        'source_audio' => [
            'prefix' => 'source-audio',
            // A 24-bit 48kHz stereo master runs to a few hundred megabytes.
            'max_bytes' => 600 * 1024 * 1024,
            'mimes' => [
                'audio/wav', 'audio/x-wav', 'audio/wave', 'audio/vnd.wave',
                'audio/mpeg', 'audio/mp3',
                'audio/aiff', 'audio/x-aiff',
                'application/zip',
            ],
            'retain_days' => null,
        ],

        'delivered_master' => [
            'prefix' => 'delivered',
            'max_bytes' => 600 * 1024 * 1024,
            'mimes' => [
                'audio/wav', 'audio/x-wav', 'audio/mpeg', 'audio/mp3',
                'application/zip',
            ],
            'retain_days' => null,
        ],

        /*
         * Photo ID is sensitive personal data under UK GDPR, and the brief
         * involves under-18s. Small cap, images only, and a retention period
         * so it is deleted rather than accumulating forever.
         *
         * Open question for the studio: whether ID needs storing at all, or
         * only checking once. Verify-and-delete is far safer and needs no
         * retention policy.
         */
        'id_document' => [
            'prefix' => 'id-documents',
            'max_bytes' => 10 * 1024 * 1024,
            'mimes' => ['image/jpeg', 'image/png', 'image/webp', 'application/pdf'],
            'retain_days' => (int) env('ID_DOCUMENT_RETAIN_DAYS', 90),
        ],

        'payment_proof' => [
            'prefix' => 'payment-proofs',
            'max_bytes' => 10 * 1024 * 1024,
            'mimes' => ['image/jpeg', 'image/png', 'image/webp', 'application/pdf'],
            // Kept as long as the payment it evidences, for accounting.
            'retain_days' => null,
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Link timings
    |--------------------------------------------------------------------------
    |
    | Upload URLs live long enough for a slow connection to finish a large
    | file. Read URLs are deliberately short — a link to somebody's passport
    | should not survive being pasted into a group chat.
    |
    */

    'upload_url_minutes' => (int) env('UPLOAD_URL_MINUTES', 120),
    'read_url_minutes' => (int) env('READ_URL_MINUTES', 10),

];
