security:
    password_hashers:
        Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'

    providers:
        app_user_provider:
            entity:
                class: App\Entity\User
                property: email

    role_hierarchy:
        ROLE_CUSTOMER: ROLE_USER
        ROLE_SHOPKEEPER: ROLE_USER
        ROLE_ACCOUNTANT: ROLE_USER
        ROLE_MANAGER: [ROLE_ACCOUNTANT, ROLE_SHOPKEEPER]
        ROLE_ADMIN: [ROLE_MANAGER, ROLE_CUSTOMER]
        ROLE_SUPER_ADMIN: ROLE_ADMIN

    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            lazy: true
            provider: app_user_provider
            form_login:
                login_path: app_login
                check_path: app_login
                success_handler: App\Security\LoginSuccessHandler
                enable_csrf: true
            logout:
                path: app_logout
                target: app_login
            remember_me:
                secret: '%kernel.secret%'
                lifetime: 604800 # 1 week

    access_control:
        - { path: ^/$, roles: PUBLIC_ACCESS }
        - { path: ^/contact-submit, roles: PUBLIC_ACCESS }
        - { path: ^/login, roles: PUBLIC_ACCESS }
        - { path: ^/shop, roles: PUBLIC_ACCESS }
        - { path: ^/cart$, roles: PUBLIC_ACCESS }
        - { path: ^/cart/add, roles: PUBLIC_ACCESS }
        - { path: ^/guest-cart, roles: PUBLIC_ACCESS }
        - { path: ^/guest-checkout, roles: PUBLIC_ACCESS }
        - { path: ^/order/, roles: PUBLIC_ACCESS }
        - { path: ^/admin/user, roles: ROLE_SUPER_ADMIN }
        - { path: ^/admin/cms, roles: ROLE_SUPER_ADMIN }
        - { path: ^/admin/settings, roles: ROLE_ADMIN }
        - { path: ^/admin, roles: ROLE_SHOPKEEPER }
        - { path: ^/portal, roles: ROLE_CUSTOMER }

when@test:
    security:
        password_hashers:
            Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
                algorithm: auto
                cost: 4
                time_cost: 3
                memory_cost: 10
