@import play.routes.compiler._
@import play.routes.compiler.templates._
@(sourceInfo: RoutesSourceInfo, pkg: Option[String], imports: Seq[String], packageName: Option[String], routes: Seq[Route], namespaceReverseRouter: Boolean, useInjector: Route => Boolean)
// @@GENERATOR:play-routes-compiler
// @@SOURCE:@sourceInfo.source
// @@DATE:@sourceInfo.date

import play.api.mvc.Call

@for(i <- imports) {
import @if(!i.startsWith("_root_.")){_root_.}@i}

@markLines(routes: _*)
@{packageName.map("package " + _ + " ").getOrElse("")}@if(packageName.isDefined){@ob}
@for((controller, routes) <- groupRoutesByController(routes)) {
  @markLines(routes: _*)
  class Reverse@(controller.replace(".", "_"))(_prefix: => String) @ob
    def _defaultPrefix: String = @ob
      if (_prefix.endsWith("/")) "" else "/"
    @cb

  @for(((method, _), routes) <- groupRoutesByMethod(routes)) {@routes match {
  case Seq(route: Route) => {
    @markLines(route)
    def @(method)(@reverseSignature(routes)): Call = @ob
      @reverseRouteContext(route)
      @reverseCall(route)
    @cb
  }
  case _ => {
    @markLines(routes: _*)
    def @(method)(@reverseSignature(routes)): Call = @ob
    @defining(reverseParameters(routes)) { params =>
      (@reverseMatchParameters(params, true)) match @ob
      @reverseUniqueConstraints(routes, params) { (route, parameters, parameterConstraints, localNames) =>
        @markLines(route)
        case (@parameters) @parameterConstraints =>
          @reverseRouteContext(route)
          @reverseCall(route, localNames)
      }
      @cb
    }
    @cb
  }}}
  @cb
}

@if(packageName.isDefined){@cb}
