# additional services related to Flysystem
parameters:
    # Allowed extensions for images
    upload_images_allowed_extensions: ['png', 'jpg', 'jpeg']

    # Allowed maxsize by file (mb) 
    upload_maxsize_by_file: 1
    
    # Allowed maxsize for multiple uploads (mb)
    upload_maxsize_total: 5

    # Max number of photos/images by product
    upload_max_images: 5

    # S3 Bucket config
    storage_endpoint: '%env(string:STORAGE_ENDPOINT)%'
    storage_region: '%env(string:STORAGE_REGION)%'
    storage_use_path_style_endpoint: '%env(bool:STORAGE_USE_PATH_STYLE_ENDPOINT)%'
    storage_key: '%env(string:STORAGE_KEY)%'
    storage_secret: '%env(string:STORAGE_SECRET)%'

services:
    _defaults:
        autowire: true
        autoconfigure: true

    _instanceof:
        App\Twig\FlysystemImageInterface:
            tags: [app.flysystem_image_extension]

        App\Twig\FlysystemImagesInterface:
            tags: [app.flysystem_images_extension]

    App\Twig\:
        resource: '../../src/Twig/'

    App\Twig\ImageExtensionCollection:
        arguments:
            - !tagged_iterator app.flysystem_image_extension

    App\Twig\ImagesExtensionCollection:
        arguments:
            - !tagged_iterator app.flysystem_images_extension

    Aws\S3\S3Client:
        arguments:
            - endpoint: '%storage_endpoint%'
              version: 'latest'
              region: '%storage_region%'
              use_path_style_endpoint: '%storage_use_path_style_endpoint%'
              credentials:
                  key: '%storage_key%'
                  secret: '%storage_secret%'
