package router

func registerMatchingRoutes(cfg *Config) {
	e := cfg.Echo

	// JWT middleware for protected routes
	jwtMiddleware := createJWTMiddleware(cfg)
	protected := e.Group("/api", jwtMiddleware)

	// Book matching and linking routes (all authenticated users)
	protected.POST("/devices/:deviceId/sync/link-book", cfg.MatchingHandler.LinkBook)
	protected.GET("/devices/:deviceId/sync/unlinked-books", cfg.MatchingHandler.GetUnlinkedBooks)

	// File alias routes (all authenticated users)
	protected.GET("/devices/:id/file-aliases", cfg.MatchingHandler.GetDeviceFileAliases)
	protected.POST("/devices/:id/file-aliases", cfg.MatchingHandler.CreateDeviceFileAlias)
	protected.PUT("/devices/:id/file-aliases/:aliasId", cfg.MatchingHandler.UpdateDeviceFileAlias)
	protected.DELETE("/devices/:id/file-aliases/:aliasId", cfg.MatchingHandler.DeleteDeviceFileAlias)
	protected.GET("/books/match", cfg.MatchingHandler.GetBookMatches)
}
