# This file is a part of the Sylius package.
# (c) Sylius Sp. z o.o.

sylius_shop_account_order:
    resource: "@SyliusShopBundle/Resources/config/routing/account/order.yml"
    prefix: /orders

sylius_shop_account_address_book:
    resource: "@SyliusShopBundle/Resources/config/routing/account/address_book.yml"
    prefix: /address-book

sylius_shop_account_root:
    path: /
    methods: [GET]
    defaults:
        _controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
        route: sylius_shop_account_dashboard
        permanent: true

sylius_shop_account_dashboard:
    path: /dashboard
    methods: [GET]
    defaults:
        _controller: sylius.controller.customer::showAction
        _sylius:
            template: "@SyliusShop/Account/dashboard.html.twig"
            repository:
                method: find
                arguments:
                    - "expr:service('sylius.context.customer').getCustomer()"

sylius_shop_account_profile_update:
    path: /profile/edit
    methods: [GET, PUT]
    defaults:
        _controller: sylius.controller.customer::updateAction
        _sylius:
            template: "@SyliusShop/Account/profileUpdate.html.twig"
            form: Sylius\Bundle\CustomerBundle\Form\Type\CustomerProfileType
            repository:
                method: find
                arguments:
                    - "expr:service('sylius.context.customer').getCustomer()"
            redirect:
                route: sylius_shop_account_profile_update
                parameters: {}

sylius_shop_account_change_password:
    path: /change-password
    methods: [GET, POST]
    defaults:
        _controller: sylius.controller.shop_user::changePasswordAction
        _sylius:
            template: "@SyliusShop/Account/changePassword.html.twig"
            redirect: sylius_shop_account_dashboard
