#!/usr/bin/env python

#
# User route descriptor.
#

from dm.common.utility.configurationManager import ConfigurationManager
from userInfoSessionController import UserInfoSessionController

class UserRouteDescriptor:

    @classmethod
    def getRoutes(cls):
        contextRoot = ConfigurationManager.getInstance().getContextRoot()

        # Static instances shared between different routes
        userInfoSessionController = UserInfoSessionController()

        # Define routes.
        routes = [

            # Get user info list
            {
                'name' : 'getUsers',
                'path' : '%s/users' % contextRoot,
                'controller' : userInfoSessionController,
                'action' : 'getUsers', 
                'method' : ['GET']
            },

            # Get user by id
            {
                'name' : 'getUserById',
                'path' : '%s/users/:(id)' % contextRoot,
                'controller' : userInfoSessionController,
                'action' : 'getUserById', 
                'method' : ['GET']
            },

            # Get user by username
            {
                'name' : 'getUserByUsername',
                'path' : '%s/usersByUsername/:(username)' % contextRoot,
                'controller' : userInfoSessionController,
                'action' : 'getUserByUsername', 
                'method' : ['GET']
            },

        ]
       
        return routes