<?php

namespace AutoAdmin\Bundle\Media\Library;

use AutoAdmin\Bundle\Media\Entity\FileMedia;
use AutoAdmin\Bundle\Media\Entity\ImageMedia;
use AutoAdmin\Bundle\Media\Entity\PrivateFileMedia;
use AutoAdmin\Bundle\Media\Entity\PrivateImageMedia;

class MappingsConfig
{
    const DEFAULT_IMAGE_MIMES = [
        'image/jpeg',
        'image/png',
        'image/gif',
        'image/webp',
    ];

    const DEFAULT_FILE_MIMES = [
        'application/pdf',
        'text/csv',
        // xlsx
        'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
        // xls
        'application/vnd.ms-excel',
    ];

    const DEFAULT_DISPLAY_MAX_SIZE = 5242880;

    public static function default(): array
    {
        return [
            'image' => [
                'label' => 'Image',
                'class' => ImageMedia::class,
                'type' => 'image',
                'path' => '/public/media/{site_slug}/{type_slug}/{filename}',
                'public_path' => '/media/{site_slug}/{type_slug}/{filename}',
                'mime_types' => self::DEFAULT_IMAGE_MIMES,
                'display_max_size' => self::DEFAULT_DISPLAY_MAX_SIZE,
            ],
            'private_image' => [
                'label' => 'Image (privée)',
                'class' => PrivateImageMedia::class,
                'type' => 'private_image',
                'path' => '/var/aa_media/{site_slug}/{type_slug}/{filename}',
                'public_path' => '/admin/fr/library/serve/{site_slug}/{type_slug}/{filename}',
                'mime_types' => self::DEFAULT_IMAGE_MIMES,
                'display_max_size' => self::DEFAULT_DISPLAY_MAX_SIZE,
            ],
            'file' => [
                'label' => 'Fichier',
                'class' => FileMedia::class,
                'type' => 'file',
                'path' => '/public/media/{site_slug}/{type_slug}/{filename}',
                'public_path' => '/media/{site_slug}/{type_slug}/{filename}',
                'mime_types' => self::DEFAULT_FILE_MIMES,
                'display_max_size' => self::DEFAULT_DISPLAY_MAX_SIZE,
            ],
            'private_file' => [
                'label' => 'Fichier (privé)',
                'class' => PrivateFileMedia::class,
                'type' => 'private_file',
                'path' => '/var/aa_media/{site_slug}/{type_slug}/{filename}',
                'public_path' => '/admin/fr/library/serve/{site_slug}/{type_slug}/{filename}',
                'mime_types' => self::DEFAULT_FILE_MIMES,
                'display_max_size' => self::DEFAULT_DISPLAY_MAX_SIZE,
            ],
            // TODO: iframes (youtube)
        ];
    }
}
