# Merb::Router is the request routing mapper for the merb framework.
#
# You can route a specific URL to a controller / action pair:
#
#   match("/contact").
#     to(:controller => "info", :action => "contact")
#
# You can define placeholder parts of the url with the :symbol notation. These
# placeholders will be available in the params hash of your controllers. For example:
#
#   match("/books/:book_id/:action").
#     to(:controller => "books")
#   
# Or, use placeholders in the "to" results for more complicated routing, e.g.:
#
#   match("/admin/:module/:controller/:action/:id").
#     to(:controller => ":module/:controller")
#
# You can specify conditions on the placeholder by passing a hash as the second
# argument of "match"
#
#   match("/registration/:course_name", :course_name => /^[a-z]{3,5}-\d{5}$/).
#     to(:controller => "registration")
#
# You can also use regular expressions, deferred routes, and many other options.
# See merb/specs/merb/router.rb for a fairly complete usage sample.

Merb.logger.info("Compiling routes...")
Merb::Router.prepare do
  resources :membership_requests

	match('/groups/block_request').to(:controller => 'groups', :action => 'block_request')
	match('/groups/accept_request').to(:controller => 'groups', :action => 'accept_request')
	match('/groups/reject_request').to(:controller => 'groups', :action => 'reject_request')
	match('/groups/request_membership').to(:controller => 'groups', :action => 'request_membership')
	

	match('/whiteboards/block_request').to(:controller => 'whiteboards', :action => 'block_request')
	match('/whiteboards/accept_request').to(:controller => 'whiteboards', :action => 'accept_request')
	match('/whiteboards/reject_request').to(:controller => 'whiteboards', :action => 'reject_request')
	match('/whiteboards/request_ownership').to(:controller => 'whiteboards', :action => 'request_ownership')
	
	
	resources :groups


  # RESTful routes
  resources :whiteboards do |whiteboards|
    whiteboards.resources :images
    whiteboards.resources :snapshots
  end
  
  resources :users
  
  # Adds the required routes for merb-auth using the password slice
  slice(:merb_auth_slice_password, :name_prefix => nil, :path_prefix => "")

  # This is the default route for /:controller/:action/:id
  # This is fine for most cases.  If you're heavily using resource-based
  # routes, you may want to comment/remove this line to prevent
  # clients from calling your create or destroy actions with a GET
  default_routes
  
  # Change this for your home page to be available at /
  match('/').to(:controller => 'home', :action =>'index')
end
