package closings

import (
	m "gitlab.com/mbugroup/lti-api.git/internal/middleware"
	controller "gitlab.com/mbugroup/lti-api.git/internal/modules/closings/controllers"
	closing "gitlab.com/mbugroup/lti-api.git/internal/modules/closings/services"
	user "gitlab.com/mbugroup/lti-api.git/internal/modules/users/services"

	"github.com/gofiber/fiber/v2"
)

func ClosingRoutes(v1 fiber.Router, u user.UserService, s closing.ClosingService, sapronakSvc closing.SapronakService, closingKeuanganSvc closing.ClosingKeuanganService) {
	ctrl := controller.NewClosingController(s, sapronakSvc, closingKeuanganSvc)

	route := v1.Group("/closings")
	route.Use(m.Auth(u))

	// route.Get("/", m.Auth(u), ctrl.GetAll)
	// route.Post("/", m.Auth(u), ctrl.CreateOne)
	// route.Get("/:id", m.Auth(u), ctrl.GetOne)
	// route.Patch("/:id", m.Auth(u), ctrl.UpdateOne)
	// route.Delete("/:id", m.Auth(u), ctrl.DeleteOne)

	route.Get("/", m.RequirePermissions(m.P_ClosingGetAll), ctrl.GetAll)
	route.Get("/:project_flock_id/penjualan", m.RequirePermissions(m.P_ClosingDetail), ctrl.GetPenjualan)
	route.Get("/:project_flock_id/:project_flock_kandang_id/penjualan", m.RequirePermissions(m.P_ClosingDetail), ctrl.GetPenjualanByProjectFlockKandang)
	route.Get("/:projectFlockId", m.RequirePermissions(m.P_ClosingDetail), ctrl.GetClosingSummary)
	route.Get("/:project_flock_id/overhead", m.RequirePermissions(m.P_ClosingDetail), ctrl.GetOverhead)
	route.Get("/:project_flock_id/:project_flock_kandang_id/overhead", m.RequirePermissions(m.P_ClosingDetail), ctrl.GetOverhead)
	route.Get("/:project_flock_id/:project_flock_kandang_id/perhitungan_sapronak", m.RequirePermissions(m.P_ClosingDetail), ctrl.GetSapronakByKandang)
	route.Get("/:project_flock_id/perhitungan_sapronak", m.RequirePermissions(m.P_ClosingDetail), ctrl.GetSapronakByProject)
	route.Get("/:projectFlockId/sapronak", m.RequirePermissions(m.P_ClosingDetail), ctrl.GetClosingSapronak)
	route.Get("/:projectFlockId/sapronak/summary", m.RequirePermissions(m.P_ClosingDetail), ctrl.GetClosingSapronakSummary)
	route.Get("/:project_flock_id/expedition-hpp", m.RequirePermissions(m.P_ClosingDetail), ctrl.GetExpeditionHPP)
	route.Get("/:project_flock_id/:project_flock_kandang_id/expedition-hpp", m.RequirePermissions(m.P_ClosingDetail), ctrl.GetExpeditionHPPByKandang)
	route.Get("/:projectFlockId/production-data", m.RequirePermissions(m.P_ClosingDetail), ctrl.GetClosingDataProduksi)
	route.Get("/:projectFlockId/keuangan", m.RequirePermissions(m.P_ClosingDetail), ctrl.GetClosingKeuangan)
	route.Get("/:project_flock_id/:project_flock_kandang_id/keuangan", m.RequirePermissions(m.P_ClosingDetail), ctrl.GetClosingKeuanganByKandang)

}
