<?xml version="1.0" encoding="UTF-8" ?>

<routes xmlns="http://symfony.com/schema/routing"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">

    <route id="ajax.mini-cart" path="/ajax/mini-cart">
        <default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
        <default key="_view">includes/mini-cart</default>
    </route>
    <route id="ajax.addCartMessage" path="/ajax/addCartMessage">
        <default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
        <default key="_view">includes/addedToCart</default>
    </route>


    <!-- Register -->
    <route id="customer.create.process" path="/register" methods="post">
        <default key="_controller">Thelia\Controller\Front\CustomerController::createAction</default>
        <default key="_view">register</default>
    </route>

    <!-- Login -->
    <route id="customer.login.process" path="/login" methods="post">
        <default key="_controller">Thelia\Controller\Front\CustomerController::loginAction</default>
        <default key="_view">login</default>
    </route>

    <!-- Forgot Password -->
    <route id="customer.password.retrieve.process" path="/password" methods="post">
        <default key="_controller">Thelia\Controller\Front\CustomerController::newPasswordAction</default>
        <default key="_view">password</default>
    </route>

    <!-- Logout -->
    <route id="customer.logout.process" path="/logout">
        <default key="_controller">Thelia\Controller\Front\CustomerController::logoutAction</default>
    </route>

    <!-- Account -->
    <route id="customer.update.view" path="/account/update" methods="get">
        <default key="_controller">Thelia\Controller\Front\CustomerController::viewAction</default>
        <default key="_view">account-update</default>
    </route>

    <route id="customer.update.process" path="/account/update" methods="post">
        <default key="_controller">Thelia\Controller\Front\CustomerController::updateAction</default>
        <default key="_view">account-update</default>
    </route>


    <route id="customer.password.change.process" path="/account/password" methods="post">
        <default key="_controller">Thelia\Controller\Front\CustomerController::updatePasswordAction</default>
        <default key="_view">account-password</default>
    </route>

    <route id="customer.password.change.view" path="/account/password" methods="get">
        <default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
        <default key="_view">account-password</default>
    </route>
    <!-- end customer routes -->

    <!-- customer address routes -->
    <route id="address.create.view" path="/address/create" methods="get">
        <default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
        <default key="_view">address</default>
    </route>

    <route id="address.create" path="/address/create" methods="post" >
        <default key="_controller">Thelia\Controller\Front\AddressController::createAction</default>
        <default key="_view">address</default>
    </route>

    <route id="address.edit" path="/address/update/{address_id}" methods="get">
        <default key="_controller">Thelia\Controller\Front\AddressController::updateViewAction</default>
        <default key="_view">address-update</default>
    </route>

    <route id="address.update" path="/address/update/{address_id}" methods="post" >
        <default key="_controller">Thelia\Controller\Front\AddressController::processUpdateAction</default>
        <default key="_view">address-update</default>
    </route>

    <route id="address.delete" path="/address/delete/{address_id}">
        <default key="_controller">Thelia\Controller\Front\AddressController::deleteAction</default>
        <default key="_view">account</default>
    </route>

    <route id="address.generateModal" path="/address/modal/{address_id}" methods="get">
        <default key="_controller">Thelia\Controller\Front\AddressController::generateModalAction</default>
        <default key="_view">modal-address</default>
        <requirement key="address_id">\d+</requirement>
    </route>

    <!-- end customer address routes -->

    <!-- cart routes -->
    <route id="cart.view" path="/cart">
        <default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
        <default key="_view">cart</default>
    </route>

    <route id="cart.add.process" path="/cart/add">
        <default key="_controller">Thelia\Controller\Front\CartController::addItem</default>
    </route>

    <route id="cart.delete.process" path="/cart/delete/{cart_item}">
        <default key="_controller">Thelia\Controller\Front\CartController::deleteItem</default>
        <default key="_view">cart</default>
    </route>

    <route id="cart.update.quantity" path="/cart/update">
        <default key="_controller">Thelia\Controller\Front\CartController::changeItem</default>
        <default key="_view">cart</default>
    </route>
    <!-- end cart routes -->

    <!-- order management process -->
    <route id="order.delivery.process" path="/order/delivery" methods="post">
        <default key="_controller">Thelia\Controller\Front\OrderController::deliver</default>
        <default key="_view">order-delivery</default>
    </route>

    <route id="order.delivery" path="/order/delivery">
        <default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
        <default key="_view">order-delivery</default>
    </route>

    <route id="order.invoice.process" path="/order/invoice" methods="post">
        <default key="_controller">Thelia\Controller\Front\OrderController::invoice</default>
        <default key="_view">order-invoice</default>
    </route>

    <route id="order.invoice" path="/order/invoice">
        <default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
        <default key="_view">order-invoice</default>
    </route>

    <route id="order.coupon.process" path="/order/coupon" methods="post">
        <default key="_controller">Thelia\Controller\Front\CouponController::consumeAction</default>
        <default key="_view">order-invoice</default>
    </route>

    <route id="order.payment.process" path="/order/pay">
        <default key="_controller">Thelia\Controller\Front\OrderController::pay</default>
    </route>

    <route id="order.placed" path="/order/placed/{order_id}">
        <default key="_controller">Thelia\Controller\Front\OrderController::orderPlaced</default>
        <default key="_view">order-placed</default>
    </route>
    <!-- end order management process -->

    <route id="mail.test" path="/mail/test">
        <default key="_controller">Thelia\Controller\Front\Mail::test</default>
    </route>

    <!-- contact management -->
    <route id="contact.send" path="/contact" methods="post">
        <default key="_controller">Thelia\Controller\Front\ContactController::sendAction</default>
        <default key="_view">contact</default>
    </route>

    <route id="contact.success" path="/contact/success">
        <default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
        <default key="_view">contact-success</default>
    </route>
    <!-- end contact management -->

    <!-- newsletter management -->
    <route id="newsletter.process" path="/newsletter" methods="post">
        <default key="_controller">Thelia\Controller\Front\NewsletterController::subscribeAction</default>
        <default key="_view">newsletter</default>
    </route>
    <!-- end newsletter management -->

    <!-- Default Route -->
    <route id="default" path="/{_view}">
        <default key="_controller">Thelia\Controller\Front\DefaultController::noAction</default>
        <default key="_view">index</default>
        <requirement key="_view">^(?!admin)[^/]+</requirement>
    </route>

</routes>
