# This file cannot import the main ' config.yml' file because it defines its own
# security configuration and 'config.yml' also contains some basic security configuration
# This avoids the following error:
# Symfony\Component\Config\Definition\Exception\InvalidConfigurationException:
# You are not allowed to define new elements for path "security.firewalls".
# Please define all elements for this path in one config file.

parameters:
    locale: en
    database_path: '%kernel.root_dir%/../../../build/test.db'

framework:
    secret:          secret
    translator:      ~
    default_locale:  '%locale%'
    test:            ~
    router:          { resource: "%kernel.root_dir%/config/routing_override.yml" }
    form:            true
    validation:      { enable_annotations: true }
    profiler:
        collect: true
    session:
        storage_id: session.storage.mock_file

doctrine:
    dbal:
        driver: pdo_sqlite
        path:   '%database_path%'
    orm:
        auto_generate_proxy_classes: true
        auto_mapping: true
        mappings:
            FunctionalTestEntities:
                mapping: true
                type: annotation
                dir: '%kernel.root_dir%/../AppTestBundle/Entity/FunctionalTests/'
                alias: 'FunctionalTests'
                prefix: 'AppTestBundle\Entity\FunctionalTests'
                is_bundle: false

services:
    logger:
        class: Psr\Log\NullLogger

security:
    encoders:
        Symfony\Component\Security\Core\User\User: plaintext
    providers:
        in_memory:
            memory:
                users:
                    admin:
                        password: 'pa$$word'
                        roles: [ROLE_USER]
    firewalls:
        main:
            pattern: ^/
            anonymous: true
            logout: true
            http_basic:
                provider: in_memory
    access_control:
        - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY }

easy_admin:
    site_name: 'ACME Backend'
    design:
        form_theme:   'horizontal'
        color_scheme: 'light'
        brand_color:  '#123456'
    list:
        title: 'Global Title for List'
    search:
        title: 'Global Title for Search in Singular|Global Title for Search in Plural'
    show:
        title: 'Global Title for Show'
    new:
        title: 'Global Title for New'
    edit:
        title: 'Global Title for Edit'
    entities:
        Category:
            help:  'Global help message for categories'
            class: AppTestBundle\Entity\FunctionalTests\Category
            label: 'Categories'
            list:
                title: 'Product %%entity_label%%'
                sort: ['id', 'DESC']
                actions:
                    - 'show'
                    - { name: 'new', label: 'New %%entity_name%%', icon: 'plus-circle', css_class: 'custom_class_new' }
                    - { name: 'search', label: 'Look for %%entity_label%%', css_class: 'custom_class_search' }
                    - { name: 'custom_action_1', label: '', title: 'Custom Action 1', icon: 'custom-icon-1' }
                    - { name: 'custom_action_2', label: 'Action 2', title: 'Custom Action 2', icon: 'custom-icon-2' }
                fields:
                    - 'id'
                    - { property: 'name', label: 'Label', css_class: 'custom_class_list' }
                    - { property: 'parent', label: 'Parent category' }
            search:
                sort: ['name', 'ASC']
            show:
                title: 'Details for %%entity_name%% number %%entity_id%%'
                help:  'Help message overridden for the show view of categories'
                actions:
                    - { name: 'edit', label: 'Modify %%entity_name%%', icon: 'pencil-square' }
                    - '-delete'
                    - { name: 'list', label: 'Back to %%entity_name%% listing', icon: 'list' }
                fields:
                    - { property: 'id', label: '#' }
                    - { property: 'name', label: 'Label' }
                    - { property: 'parent', label: 'Parent category' }
            form:
                # prevent inheriting the global help message for form-related views
                help:  ~
                title: 'Add a new %%entity_name%%'
                actions:
                    - { name: 'list', label: 'Return to listing', icon: 'list' }
                fields:
                    - { property: 'id', css_class: 'custom_class_id' }
                    - { property: 'name', label: 'Label', css_class: 'custom_class_name' }
                    - { property: 'parent', label: 'Parent Category Label', css_class: 'custom_class_parent' }
            edit:
                help:  'Help message overridden for the edit view of categories'
                title: 'Modify %%entity_name%% (%%entity_id%%) details'
                actions:
                    - { name: 'delete', label: 'Remove', icon: 'minus-circle' }
                    - { name: 'list', label: 'Return to listing', icon: 'list' }
            new:
                form_options: { validation_groups: ['Default', 'Validate'], attr: { novalidate: 'novalidate' } }
        Image:
            class: AppTestBundle\Entity\FunctionalTests\Image
            label: 'Images'
        Purchase:
            class: AppTestBundle\Entity\FunctionalTests\Purchase
            label: 'Purchases'
            list:
                fields:
                    - id
                    - { property: 'deliveryDate', format: 'Ymd' }
                    - { property: 'deliveryHour', format: 'H:i' }
        PurchaseItem:
            class: AppTestBundle\Entity\FunctionalTests\PurchaseItem
            label: 'Purchase Items'
        Product:
            class: AppTestBundle\Entity\FunctionalTests\Product
            label: 'Products'
            list:
                fields:
                    - id
                    - name
                    - { property: 'price', format: '%.2f' }
                    - { property: 'ean', label: 'EAN13', type: 'string' }
                    - enabled
                    - { property: 'createdAt', format: 'j / M / Y' }
                    - tags
                    - thisFieldIsVirtual # this field doesn't correspond to a valid Doctrine property
            show:
                fields:
                    - id
                    - name
                    - { property: 'ean', type: 'string' }
                    - description
                    - price
                    - features
                    - enabled
                    - createdAt
            form:
                fields:
                    - 'name'
                    - { property: price, type: 'number', help: 'Prices are always in euros' }
                    - { property: 'ean', label: 'EAN', help: 'EAN 13 valid code. Leave empty if unknown.' }
                    - { property: 'enabled', label: 'Custom Label' }
                    - 'description'
                    - { property: 'categories', type: 'easyadmin_autocomplete', help: 'Custom help message' }
