# Routes
# This file defines all application routes (Higher priority routes first)
# https://www.playframework.com/documentation/latest/ScalaRouting
# ~~~~

GET   /               @controllers.Default.redirect(to = "/foodsearch?")

GET   /initialize     com.weEat.controllers.ViewController.initalizer()
POST  /initialize     com.weEat.controllers.ViewController.initalize()

# TODO: make this a configurable setting
# Shared Route
# body: com.weEat.shared.models.UserRegistration
# type: com.weEat.shared.models.UserAuthorization
#PUT   /v1/user/          com.weEat.controllers.UserController.registerUser()

# Shared Route
# type: Seq[String]
GET   /v1/user/           com.weEat.controllers.UserController.getUsers()

# Shared Route
# type: com.weEat.shared.models.User
GET   /v1/user/:id        com.weEat.controllers.UserController.get(id: String)

# Shared Route
# body: com.weEat.shared.models.GrantRequest
# type: com.weEat.shared.models.UserAuthorization
POST  /v1/authorize/     com.weEat.controllers.UserController.accessToken()

# Shared Route
# body: com.weEat.shared.models.RefreshRequest
DELETE /v1/authorize/   com.weEat.controllers.UserController.revokeAccessToken()

# Shared Route
# body: com.weEat.shared.models.PasswordChange
# type: com.weEat.shared.models.UserAuthorization
POST /v1/authorize/changePassword com.weEat.controllers.UserController.changePassword()

# Shared Route
# mime: text/plain
# type: String
GET   /v1/user/self/name/ com.weEat.controllers.UserController.getName()

# Shared Route
# body: com.weEat.shared.models.FoodNode
# type: com.weEat.shared.models.FoodNodeId
PUT  /v1/food/     com.weEat.controllers.FoodController.add(uid: Option[String] ?= None)

# Shared Route
# body: com.weEat.shared.models.FoodNode
# type: com.weEat.shared.models.FoodNodeId
POST /v1/food/:id  com.weEat.controllers.FoodController.update(id: String, uid: Option[String] ?= None)

# Shared Route
# type: Seq[com.weEat.shared.models.FoodNodeId]
GET  /v1/food/     com.weEat.controllers.FoodController.query(q: String)

# Shared Route
# type: Seq[com.weEat.shared.models.FoodNodeId]
GET  /v1/food/     com.weEat.controllers.FoodController.all()

# Shared Route
# type: com.weEat.shared.models.FoodNodeId
GET  /v1/food/:id  com.weEat.controllers.FoodController.get(id: String)

# Shared Route
# type: com.weEat.shared.models.FoodNodeId
#GET  /v1/food/:id/image/:img  com.weEat.controllers.FoodController.get(id: String, img: String)

# Shared Route
# type: com.weEat.shared.models.FoodNodeId
#PUT  /v1/food/:id/image  com.weEat.controllers.FoodController.addImageTo(id: String)

# Shared Route
#DELETE  /v1/food/:id/image/:img  com.weEat.controllers.FoodController.deleteImage(id: String, img: String)

# Shared Route
# content: text
# body: String
# type: com.weEat.shared.models.RecipeNodeNoId
POST  /v1/food/recipe/parse com.weEat.controllers.ParserController.parseURL()

# Shared Route
# type: gov.usda.nal.fdc.models.FoodItem
#GET   /fdc/food   com.weEat.controllers.USDAController.getFoods(id: String, fmt: String ?= "Full")

# Shared Route
# type: gov.usda.nal.fdc.models.SearchResult
GET   /fdc/food/search   com.weEat.controllers.USDAController.getFoodsSearch(q: String, dataType: Seq[String] ?= Nil, pageSize: Option[Short] ?= None, pageNumber: Option[Long] ?= None, sortBy: Option[String] ?= None, sortOrder: Option[String] ?= None)

# Shared Route
# body: gov.usda.nal.fdc.models.FoodSearchCriteria
# type: gov.usda.nal.fdc.models.SearchResult
POST   /fdc/food/search   com.weEat.controllers.USDAController.postFoodsSearch()

# Shared Route
# type: Seq[gov.usda.nal.fdc.models.Nutrient]
GET   /fdc/nutrient      com.weEat.controllers.USDAController.getNutrients()

# Shared Route
# type: gov.usda.nal.fdc.models.Nutrient
GET   /fdc/nutrient/:id      com.weEat.controllers.USDAController.getNutrient(id: Int)

# Shared Route
# type: gov.usda.nal.fdc.models.FoodItem
GET   /fdc/food/:id   com.weEat.controllers.USDAController.getFood(id: Long, fmt: String ?= "Full")

# Map static resources from the /public folder to the /assets URL path
GET   /assets/*file   controllers.Assets.versioned(path="/public", file: Asset)

# Forward Webjar requests to the webjar routes
->      /webjars                            webjars.Routes

GET   /:other         com.weEat.controllers.ViewController.loader(other)
