# config/packages/api_platform.yaml
api_platform:
    title: 'Marketplace API'
    version: '1.0.0'
    description: 'API pour marketplace multi-vendeurs'
    
    # Important pour la compatibilité
    use_symfony_listeners: true
    
    # Ajout du serializer pour éviter le dépréciation hydra
    serializer:
        hydra_prefix: true  # Garde le comportement actuel
    
    # Formats supportés
    formats:
        jsonld: ['application/ld+json']
        json: ['application/json']
        html: ['text/html']
        multipart: ['multipart/form-data']
    
    # Documentation
    docs_formats:
        jsonld: ['application/ld+json']
        jsonopenapi: ['application/vnd.openapi+json']
        html: ['text/html']
    
    # Paramètres par défaut
    defaults:
        stateless: true
        pagination_items_per_page: 20
        pagination_maximum_items_per_page: 100
        pagination_client_items_per_page: true
        cache_headers:
            max_age: 0
            shared_max_age: 0
            vary: ['Content-Type', 'Authorization', 'Origin']
        extra_properties:
            standard_put: true
            rfc_7807_compliant_errors: true
    
    # Pagination
    collection:
        pagination:
            enabled: true
            page_parameter_name: page
            items_per_page_parameter_name: itemsPerPage
    
    # Mapping des entités
    mapping:
        paths: ['%kernel.project_dir%/src/Entity']
    
    # Formats de patch
    patch_formats:
        json: ['application/merge-patch+json']
    
    # Swagger/OpenAPI
    swagger:
        versions: [3]
        api_keys:
            JWT:
                name: Authorization
                type: header
        
        # Documentation supplémentaire
        swagger_ui_extra_configuration:
            displayRequestDuration: true
            filter: true
    
    # Activer l'interface Swagger UI
    enable_swagger_ui: true
    enable_re_doc: true
    
    # Performance
    keep_legacy_inflector: false
    
    # Exception
    exception_to_status:
        Symfony\Component\Security\Core\Exception\AccessDeniedException: 403
        Symfony\Component\HttpKernel\Exception\NotFoundHttpException: 404
        Doctrine\ORM\OptimisticLockException: 409