package server

import (
	"catalogue.midpdsa.com/src/controllers"
	"catalogue.midpdsa.com/src/middleware"
	"github.com/gin-gonic/gin"
)

func SetupProtectedStrutBrandsRoutes(r *gin.Engine, ctrl *controllers.StrutBrandController) {
	protected := r.Group("/strut-brands")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateStrutBrand)
		protected.PUT("/:id", ctrl.UpdateStrutBrand)
		protected.DELETE("/:id", ctrl.DeleteStrutBrand)
	}
	r.GET("/strut-brands", ctrl.GetStrutBrands)
	r.GET("/strut-brands/:id", ctrl.GetStrutBrandById)
}

func SetupProtectedLegBrandsRoutes(r *gin.Engine, ctrl *controllers.LegBrandController) {
	protected := r.Group("/leg-brands")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateLegBrand)
		protected.PUT("/:id", ctrl.UpdateLegBrand)
		protected.DELETE("/:id", ctrl.DeleteLegBrand)
	}
	r.GET("/leg-brands", ctrl.GetLegBrands)
	r.GET("/leg-brands/:id", ctrl.GetLegBrandById)
}

func SetupProtectedStrutBrandSpecsRoutes(r *gin.Engine, ctrl *controllers.StrutBrandSpecsController) {
	protected := r.Group("/strut-brand-specs")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateStrutBrandSpec)
	}
	r.GET("/strut-brand-specs", ctrl.GetStrutBrandSpecsByVehicleModelYear)
	r.GET("/strut-brand-specs/:id", ctrl.GetStrutBrandSpecsById)
}

func SetupProtectedLegBrandSpecsRoutes(r *gin.Engine, ctrl *controllers.LegBrandSpecsController) {
	protected := r.Group("/leg-brand-specs")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateLegBrandSpec)
	}
	r.GET("/leg-brand-specs", ctrl.GetLegBrandSpecsByVehicleModelYear)
	r.GET("/leg-brand-specs/:id", ctrl.GetLegBrandSpecsById)
}

func SetupProtectedBrakeBrandsRoutes(r *gin.Engine, ctrl *controllers.BrakeBrandController) {
	protected := r.Group("/brake-brands")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateBrakeBrand)
		protected.PUT("/:id", ctrl.UpdateBrakeBrand)
		protected.DELETE("/:id", ctrl.DeleteBrakeBrand)
	}
	r.GET("/brake-brands", ctrl.GetBrakeBrands)
	r.GET("/brake-brands/:id", ctrl.GetBrakeBrandById)
}

func SetupProtectedBrakeBrandSpecsRoutes(r *gin.Engine, ctrl *controllers.BrakeBrandSpecsController) {
	protected := r.Group("/brake-brand-specs")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateBrakeBrandSpec)
	}
	r.GET("/brake-brand-specs", ctrl.GetBrakeBrandSpecsByVehicleModelYear)
	r.GET("/brake-brand-specs/:id", ctrl.GetBrakeBrandSpecsById)
}

func SetupProtectedBrakeStocksRoutes(r *gin.Engine, ctrl *controllers.BrakeStockController) {
	protected := r.Group("/brake-stocks")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateBrakeStock)
	}
	r.GET("/brake-stocks/by-brake-spec/:brake_spec_id", ctrl.GetBrakeStocksByBrakekSpec)
	r.GET("/brake-stocks/:brake_stock_id", ctrl.GetBrakeStockById)
}

func SetupProtectedShockBrandsRoutes(r *gin.Engine, ctrl *controllers.ShockBrandController) {
	protected := r.Group("/shock-brands")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateShockBrand)
		protected.PUT("/:id", ctrl.UpdateShockBrand)
		protected.DELETE("/:id", ctrl.DeleteShockBrand)
	}
	r.GET("/shock-brands", ctrl.GetShockBrands)
	r.GET("/shock-brands/:id", ctrl.GetShockBrandById)
}

func SetupProtectedShockBrandSpecsRoutes(r *gin.Engine, ctrl *controllers.ShockBrandSpecsController) {
	protected := r.Group("/shock-brand-specs")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateShockBrandSpec)
	}
	r.GET("/shock-brand-specs", ctrl.GetShockBrandSpecsByVehicleModelYear)
	r.GET("/shock-brand-specs/:id", ctrl.GetShockBrandSpecsById)
}

func SetupProtectedShockStocksRoutes(r *gin.Engine, ctrl *controllers.ShockStockController) {
	protected := r.Group("/shock-stocks")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateShockStock)
	}
	r.GET("/shock-stocks", ctrl.GetShockStocks)
	r.GET("/shock-stocks/by-shock-spec/:shock_spec_id", ctrl.GetShockStocksByShockSpec)
	r.GET("/shock-stocks/all", ctrl.GetShockStocks)
}

func SetupProtectedVehicleBrandsRoutes(r *gin.Engine, ctrl *controllers.VehicleBrandController) {
	protected := r.Group("/vehicle-brands")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateVehicleBrand)
	}
	r.GET("/vehicle-brands", ctrl.GetVehicleBrands)
}

func SetupProtectedVehicleTypesRoutes(r *gin.Engine, ctrl *controllers.VehicleTypeController) {
	protected := r.Group("/vehicle-types")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateVehicleType)
	}
	r.GET("/vehicle-types", ctrl.GetVehicleTypes)
}

func SetupProtectedVehicleModelYearsRoutes(r *gin.Engine, ctrl *controllers.VehicleModelYearController) {
	protected := r.Group("/vehicle-model-years")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateVehicleModelYear)
	}
	r.GET("/vehicle-model-years", ctrl.GetVehicleModelYears)
	r.GET("/vehicle-model-years/by-brand/:brand_id", ctrl.GetVehicleModelYearsByBrand)
	r.GET("/vehicle-model-years/by-type/:type_id", ctrl.GetVehicleModelYearsByType)
}

func SetupProtectedDiskBrandsRoutes(r *gin.Engine, ctrl *controllers.DiskBrandController) {
	protected := r.Group("/disk-brands")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateDiskBrand)
		protected.PUT("/:id", ctrl.UpdateDiskBrand)
		protected.DELETE("/:id", ctrl.DeleteDiskBrand)
	}
	r.GET("/disk-brands", ctrl.GetDiskBrands)
	r.GET("/disk-brands/:id", ctrl.GetDiskBrandById)
}

func SetupProtectedDiskBrandSpecsRoutes(r *gin.Engine, ctrl *controllers.DiskBrandSpecsController) {
	protected := r.Group("/disk-brand-specs")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateDiskBrandSpec)
	}
	r.GET("/disk-brand-specs/by-vehicle-model-year/:model_year_id", ctrl.GetDiskBrandSpecsByVehicleModelYear)
	r.GET("/disk-brand-specs/:spec_id", ctrl.GetDiskBrandSpecsById)
}

func SetupProtectedDiskStocksRoutes(r *gin.Engine, ctrl *controllers.DiskStockController) {
	protected := r.Group("/disk-stocks")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateDiskStock)
	}
	r.GET("/disk-stocks", ctrl.GetDiskStocks)
	r.GET("/disk-stocks/by-disk-spec/:disk_spec_id", ctrl.GetDiskStocksByDiskSpec)
}

func SetupProtectedExtraTypeProductCaracteristicsRoutes(r *gin.Engine, ctrl *controllers.ExtraTypeProductCaracteristicsController) {
	protected := r.Group("/extra-type-product-caracteristics")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateExtraTypeProductCaracteristic)
	}
	r.GET("/extra-type-product-caracteristics/:id", ctrl.GetExtraTypeProductCaracteristics)
}

func SetupProtectedExtraTypeBrandRoutes(r *gin.Engine, ctrl *controllers.ExtraTypeBrandController) {
	protected := r.Group("/extra-type-brand")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateExtraTypeBrand)
	}
	r.GET("/extra-type-brand/:id", ctrl.GetExtraTypeBrand)
}

func SetupProtectedExtraTypeProductRoutes(r *gin.Engine, ctrl *controllers.ExtraTypeProductController) {
	protected := r.Group("/extra-type-product")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateExtraTypeProduct)
	}
	r.GET("/extra-type-product/:id", ctrl.GetExtraTypeProduct)
}

func SetupProtectedExtraProductStocksRoutes(r *gin.Engine, ctrl *controllers.ExtraProductStockController) {
	protected := r.Group("/extra-product-stocks")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.POST("", ctrl.CreateExtraProductStock)
	}
	r.GET("/extra-product-stocks/:id", ctrl.GetExtraProductStocks)
}

func SetupProtectedCSVImportRoutes(r *gin.Engine, ctrl *controllers.CSVImportController) {
	protected := r.Group("/import")
	protected.Use(middleware.AuthMiddleware())
	{
		protected.GET("/csv", ctrl.ImportAll)
		protected.GET("/csv/ag-shock", ctrl.ImportAGShock)
		protected.GET("/csv/ag-strut", ctrl.ImportAGStrut)
		protected.GET("/csv/ag-leg", ctrl.ImportAGLeg)
		protected.GET("/csv/monroe-ld", ctrl.ImportMonroeLD)
		protected.GET("/csv/monroe-hd", ctrl.ImportMonroeHD)
		protected.GET("/csv/trw-sachs", ctrl.ImportTRWSachs)
		protected.GET("/csv/brembo", ctrl.ImportBrembo)
		protected.GET("/csv/cano", ctrl.ImportCano)
		protected.GET("/csv/cano-disk", ctrl.ImportCanoDisk)
		protected.GET("/csv/grc-brakes", ctrl.ImportGRCBrakes)
		protected.GET("/csv/grc-shocks", ctrl.ImportGRCShocks)
	}
}