package handler

import (
	"net/http"

	/******************** main / transaction ********************/
	adime "simrs-vx/internal/interface/main-handler/adime"
	admemployeehist "simrs-vx/internal/interface/main-handler/adm-employee-hist"
	ambulancetransportrequest "simrs-vx/internal/interface/main-handler/ambulance-transport-req"
	auth "simrs-vx/internal/interface/main-handler/authentication"
	chemo "simrs-vx/internal/interface/main-handler/chemo"
	chemoprotocol "simrs-vx/internal/interface/main-handler/chemo-protocol"
	consultation "simrs-vx/internal/interface/main-handler/consultation"
	controlletter "simrs-vx/internal/interface/main-handler/control-letter"
	counter "simrs-vx/internal/interface/main-handler/counter"
	deviceorder "simrs-vx/internal/interface/main-handler/device-order"
	deviceorderitem "simrs-vx/internal/interface/main-handler/device-order-item"
	encounter "simrs-vx/internal/interface/main-handler/encounter"
	encounterdocument "simrs-vx/internal/interface/main-handler/encounter-document"
	generalconsent "simrs-vx/internal/interface/main-handler/general-consent"
	generatefile "simrs-vx/internal/interface/main-handler/generate-file"
	internalreference "simrs-vx/internal/interface/main-handler/internal-reference"
	materialorder "simrs-vx/internal/interface/main-handler/material-order"
	materialorderitem "simrs-vx/internal/interface/main-handler/material-order-item"
	mcuorder "simrs-vx/internal/interface/main-handler/mcu-order"
	mcuorderitem "simrs-vx/internal/interface/main-handler/mcu-order-item"
	mcuordersubitem "simrs-vx/internal/interface/main-handler/mcu-order-sub-item"
	medication "simrs-vx/internal/interface/main-handler/medication"
	medicationitem "simrs-vx/internal/interface/main-handler/medication-item"
	medicationitemdist "simrs-vx/internal/interface/main-handler/medication-item-dist"
	medicicinemix "simrs-vx/internal/interface/main-handler/medicine-mix"
	medicicinemixitem "simrs-vx/internal/interface/main-handler/medicine-mix-item"
	practiceschedule "simrs-vx/internal/interface/main-handler/practice-schedule"
	prescription "simrs-vx/internal/interface/main-handler/prescription"
	prescriptionitem "simrs-vx/internal/interface/main-handler/prescription-item"
	procedurereport "simrs-vx/internal/interface/main-handler/procedure-report"
	procedureroom "simrs-vx/internal/interface/main-handler/procedure-room"
	procedureroomorder "simrs-vx/internal/interface/main-handler/procedure-room-order"
	procedureroomorderitem "simrs-vx/internal/interface/main-handler/procedure-room-order-item"
	responsibledoctorhist "simrs-vx/internal/interface/main-handler/responsible-doctor-hist"
	resume "simrs-vx/internal/interface/main-handler/resume"
	sbar "simrs-vx/internal/interface/main-handler/sbar"
	screening "simrs-vx/internal/interface/main-handler/screening"
	soapi "simrs-vx/internal/interface/main-handler/soapi"
	uploadfile "simrs-vx/internal/interface/main-handler/upload-file"

	/******************** actor ********************/
	authpartner "simrs-vx/internal/interface/main-handler/auth-partner"
	doctor "simrs-vx/internal/interface/main-handler/doctor"
	employee "simrs-vx/internal/interface/main-handler/employee"
	nurse "simrs-vx/internal/interface/main-handler/nurse"
	nutritionist "simrs-vx/internal/interface/main-handler/nutritionist"
	patient "simrs-vx/internal/interface/main-handler/patient"
	person "simrs-vx/internal/interface/main-handler/person"
	personaddress "simrs-vx/internal/interface/main-handler/person-address"
	personcontact "simrs-vx/internal/interface/main-handler/person-contact"
	personinsurance "simrs-vx/internal/interface/main-handler/person-insurance"
	pharmacist "simrs-vx/internal/interface/main-handler/pharmacist"
	user "simrs-vx/internal/interface/main-handler/user"
	userfes "simrs-vx/internal/interface/main-handler/user-fes"

	/******************** external ********************/
	a "github.com/karincake/apem"
	hk "github.com/karincake/hongkue"

	/******************** infra ********************/
	ibpjs "simrs-vx/internal/infra/bpjs"
	docscfg "simrs-vx/internal/infra/docs-cfg"
	gs "simrs-vx/internal/infra/gorm-setting"
	minio "simrs-vx/internal/infra/minio"
	ssdb "simrs-vx/internal/infra/ss-db"
	simgossync "simrs-vx/internal/infra/sync-cfg"

	/******************** pkg ********************/
	cmw "simrs-vx/pkg/cors-manager-mw"
	hc "simrs-vx/pkg/handler-crud-helper"
	lh "simrs-vx/pkg/lang-helper"
	handlerlogger "simrs-vx/pkg/middleware/handler-logger"
	mh "simrs-vx/pkg/minio-helper"
	zlc "simrs-vx/pkg/zerolog-ctx"

	/******************** sources ********************/
	antibioticsrc "simrs-vx/internal/interface/main-handler/antibiotic-src"
	antibioticsrccat "simrs-vx/internal/interface/main-handler/antibiotic-src-category"
	device "simrs-vx/internal/interface/main-handler/device"
	diagnosesrc "simrs-vx/internal/interface/main-handler/diagnose-src"
	division "simrs-vx/internal/interface/main-handler/division"
	divisionposition "simrs-vx/internal/interface/main-handler/division-position"
	doctorfee "simrs-vx/internal/interface/main-handler/doctor-fee"
	eduassesment "simrs-vx/internal/interface/main-handler/edu-assessment"
	ethnic "simrs-vx/internal/interface/main-handler/ethnic"
	infra "simrs-vx/internal/interface/main-handler/infra"
	installation "simrs-vx/internal/interface/main-handler/installation"
	installationposition "simrs-vx/internal/interface/main-handler/installation-position"
	insurancecompany "simrs-vx/internal/interface/main-handler/insurance-company"
	item "simrs-vx/internal/interface/main-handler/item"
	itemprice "simrs-vx/internal/interface/main-handler/item-price"
	language "simrs-vx/internal/interface/main-handler/language"
	material "simrs-vx/internal/interface/main-handler/material"
	materialpackage "simrs-vx/internal/interface/main-handler/material-package"
	materialpackageitem "simrs-vx/internal/interface/main-handler/material-package-item"
	mcusrc "simrs-vx/internal/interface/main-handler/mcu-src"
	mcusrccategory "simrs-vx/internal/interface/main-handler/mcu-src-category"
	mcusubsrc "simrs-vx/internal/interface/main-handler/mcu-sub-src"
	medicalactionsrc "simrs-vx/internal/interface/main-handler/medical-action-src"
	medicalactionsrcitem "simrs-vx/internal/interface/main-handler/medical-action-src-item"
	medicine "simrs-vx/internal/interface/main-handler/medicine"
	medicineform "simrs-vx/internal/interface/main-handler/medicine-form"
	medicinegroup "simrs-vx/internal/interface/main-handler/medicine-group"
	medicinemethod "simrs-vx/internal/interface/main-handler/medicine-method"
	pharmacycompany "simrs-vx/internal/interface/main-handler/pharmacy-company"
	proceduresrc "simrs-vx/internal/interface/main-handler/procedure-src"
	specialist "simrs-vx/internal/interface/main-handler/specialist"
	specialistposition "simrs-vx/internal/interface/main-handler/specialist-position"
	subspecialist "simrs-vx/internal/interface/main-handler/subspecialist"
	subspecialistposition "simrs-vx/internal/interface/main-handler/subspecialist-position"
	therapyprotocol "simrs-vx/internal/interface/main-handler/therapy-protocol"
	unit "simrs-vx/internal/interface/main-handler/unit"
	unitposition "simrs-vx/internal/interface/main-handler/unit-position"
	uom "simrs-vx/internal/interface/main-handler/uom"
	vehicle "simrs-vx/internal/interface/main-handler/vehicle"
	vehiclehist "simrs-vx/internal/interface/main-handler/vehicle-hist"

	district "simrs-vx/internal/interface/main-handler/district"
	postalregion "simrs-vx/internal/interface/main-handler/postal-region"
	province "simrs-vx/internal/interface/main-handler/province"
	regency "simrs-vx/internal/interface/main-handler/regency"
	village "simrs-vx/internal/interface/main-handler/village"

	/******************** Internal ********************/
	validation "simrs-vx/internal/interface/main-handler/helper/validation"
	"simrs-vx/internal/interface/main-handler/home"

	/******************** BPJS ********************/
	controlplan "simrs-vx/internal/interface/main-handler/control-plan"
	member "simrs-vx/internal/interface/main-handler/member"
	monitoring "simrs-vx/internal/interface/main-handler/monitoring"
	reference "simrs-vx/internal/interface/main-handler/reference"
	referral "simrs-vx/internal/interface/main-handler/referral"
	vclaimsep "simrs-vx/internal/interface/main-handler/vclaim-sep"
	vclaimsephist "simrs-vx/internal/interface/main-handler/vclaim-sep-hist"
	vclaimsepprint "simrs-vx/internal/interface/main-handler/vclaim-sep-print"
)

// One place route to relatively easier to manage, ESPECIALLY in tracking
func SetRoutes() http.Handler {
	/////
	a.RegisterExtCall(gs.Adjust)
	a.RegisterExtCall(zlc.Adjust)
	a.RegisterExtCall(ssdb.SetInstance)
	a.RegisterExtCall(lh.Populate)
	a.RegisterExtCall(minio.Connect)
	a.RegisterExtCall(mh.I.SetClient)
	a.RegisterExtCall(ibpjs.SetConfig)
	a.RegisterExtCall(validation.RegisterValidation)
	a.RegisterExtCall(simgossync.SetConfig)
	a.RegisterExtCall(docscfg.ParseCfg)
	a.RegisterExtCall(ibpjs.SetConfig)

	r := http.NewServeMux()

	/******************** Main ********************/
	r.HandleFunc("/", home.Home)

	r.HandleFunc("POST /v1/authentication/login", auth.Login)
	r.HandleFunc("POST /v1/authentication/login-fes", auth.LoginFes)
	hk.Route("POST /v1/authentication/logout", r, auth.GuardMW, auth.Logout)
	hc.RegCrud(r, "/v1/auth-partner", authpartner.O)
	hc.RegCrud(r, "/v1/practice-schedule", practiceschedule.O)
	hc.RegCrud(r, "/v1/counter", counter.O)
	hc.RegCrudByCode(r, "/v1/medicine-form", medicineform.O)
	hc.RegCrud(r, "/v1/medicine-mix", medicicinemix.O)
	hc.RegCrud(r, "/v1/medicine-mix-item", medicicinemixitem.O)
	hc.RegCrud(r, "/v1/antibiotic-src-category", antibioticsrccat.O)
	hc.RegCrud(r, "/v1/antibiotic-src", antibioticsrc.O)
	hc.RegCrud(r, "/v1/soapi", auth.GuardMW, soapi.O)
	hc.RegCrud(r, "/v1/adime", auth.GuardMW, adime.O)
	hc.RegCrud(r, "/v1/sbar", auth.GuardMW, sbar.O)
	hc.RegCrud(r, "/v1/prescription-item", prescriptionitem.O)
	hc.RegCrud(r, "/v1/device-order-item", deviceorderitem.O)
	hc.RegCrud(r, "/v1/procedure-report", auth.GuardMW, procedurereport.O)

	hc.RegCrud(r, "/v1/material-order-item", materialorderitem.O)
	hk.GroupRoutes("/v1/encounter", r, auth.GuardMW, hk.MapHandlerFunc{
		"GET /":                           encounter.O.GetList,
		"GET /{id}":                       encounter.O.GetDetail,
		"POST /":                          encounter.O.Create,
		"PATCH /{id}":                     encounter.O.Update,
		"DELETE /{id}":                    encounter.O.Delete,
		"PATCH /{id}/check-out":           encounter.O.CheckOut,
		"PATCH /{id}/check-in":            encounter.O.CheckIn,
		"PATCH /{id}/proccess":            encounter.O.Process,
		"PATCH /{id}/cancel":              encounter.O.Cancel,
		"PATCH /{id}/reject":              encounter.O.Reject,
		"PATCH /{id}/skip":                encounter.O.Skip,
		"PATCH /{id}/req-switch-unit":     encounter.O.RequestSwitchUnit,
		"PATCH /{id}/approve-switch-unit": encounter.O.ApproveSwitchUnit,
		"PATCH /{id}/cancel-switch-unit":  encounter.O.CancelSwitchUnit,
	})
	hk.GroupRoutes("/v1/mcu-order", r, auth.GuardMW, hk.MapHandlerFunc{
		"GET /":                    mcuorder.O.GetList,
		"GET /{id}":                mcuorder.O.GetDetail,
		"POST /":                   mcuorder.O.Create,
		"PATCH /{id}":              mcuorder.O.Update,
		"DELETE /{id}":             mcuorder.O.Delete,
		"PATCH /{id}/submit":       mcuorder.O.Submit,
		"PATCH /{id}/complete":     mcuorder.O.Complete,
		"PATCH /{id}/set-schedule": mcuorder.O.SetSchedule,
	})
	hk.GroupRoutes("/v1/mcu-order-item", r, hk.MapHandlerFunc{
		"GET /":                    mcuorderitem.O.GetList,
		"GET /{id}":                mcuorderitem.O.GetDetail,
		"POST /":                   mcuorderitem.O.Create,
		"PATCH /{id}":              mcuorderitem.O.Update,
		"DELETE /{id}":             mcuorderitem.O.Delete,
		"PATCH /{id}/complete":     mcuorderitem.O.Complete,
		"PATCH /{id}/set-schedule": mcuorderitem.O.SetSchedule,
	})
	hk.GroupRoutes("/v1/prescription", r, auth.GuardMW, hk.MapHandlerFunc{
		"GET /":               prescription.O.GetList,
		"GET /{id}":           prescription.O.GetDetail,
		"POST /":              prescription.O.Create,
		"PATCH /{id}":         prescription.O.Update,
		"DELETE /{id}":        prescription.O.Delete,
		"PATCH /{id}/submit":  prescription.O.Submit,
		"PATCH /{id}/approve": prescription.O.Approve,
	})
	hk.GroupRoutes("/v1/mcu-order-sub-item", r, auth.GuardMW, hk.MapHandlerFunc{
		"GET /":                mcuordersubitem.O.GetList,
		"GET /{id}":            mcuordersubitem.O.GetDetail,
		"POST /":               mcuordersubitem.O.Create,
		"PATCH /{id}":          mcuordersubitem.O.Update,
		"DELETE /{id}":         mcuordersubitem.O.Delete,
		"PATCH /{id}/complete": mcuordersubitem.O.Complete,
	})
	hk.GroupRoutes("/v1/medication", r, auth.GuardMW, hk.MapHandlerFunc{
		"GET /":                medication.O.GetList,
		"GET /{id}":            medication.O.GetDetail,
		"POST /":               medication.O.Create,
		"PATCH /{id}":          medication.O.Update,
		"DELETE /{id}":         medication.O.Delete,
		"PATCH /{id}/complete": medication.O.Complete,
	})
	hk.GroupRoutes("/v1/medication-item", r, auth.GuardMW, hk.MapHandlerFunc{
		"GET /":              medicationitem.O.GetList,
		"GET /{id}":          medicationitem.O.GetDetail,
		"POST /":             medicationitem.O.Create,
		"PATCH /{id}":        medicationitem.O.Update,
		"DELETE /{id}":       medicationitem.O.Delete,
		"PATCH /{id}/redeem": medicationitem.O.Redeem,
	})
	hk.GroupRoutes("/v1/medication-item-dist", r, auth.GuardMW, hk.MapHandlerFunc{
		"GET /":               medicationitemdist.O.GetList,
		"GET /{id}":           medicationitemdist.O.GetDetail,
		"POST /":              medicationitemdist.O.Create,
		"PATCH /{id}":         medicationitemdist.O.Update,
		"DELETE /{id}":        medicationitemdist.O.Delete,
		"PATCH /{id}/consume": medicationitemdist.O.Consume,
	})
	hk.GroupRoutes("/v1/device-order", r, auth.GuardMW, hk.MapHandlerFunc{
		"GET /":                deviceorder.O.GetList,
		"GET /{id}":            deviceorder.O.GetDetail,
		"POST /":               deviceorder.O.Create,
		"PATCH /{id}":          deviceorder.O.Update,
		"DELETE /{id}":         deviceorder.O.Delete,
		"PATCH /{id}/complete": deviceorder.O.Complete,
	})
	hk.GroupRoutes("/v1/material-order", r, auth.GuardMW, hk.MapHandlerFunc{
		"GET /":                materialorder.O.GetList,
		"GET /{id}":            materialorder.O.GetDetail,
		"POST /":               materialorder.O.Create,
		"PATCH /{id}":          materialorder.O.Update,
		"DELETE /{id}":         materialorder.O.Delete,
		"PATCH /{id}/complete": materialorder.O.Complete,
	})
	hc.RegCrud(r, "/v1/procedure-room", procedureroom.O)
	hk.GroupRoutes("/v1/procedure-room-order", r, auth.GuardMW, hk.MapHandlerFunc{
		"GET /":              procedureroomorder.O.GetList,
		"GET /{id}":          procedureroomorder.O.GetDetail,
		"POST /":             procedureroomorder.O.Create,
		"PATCH /{id}":        procedureroomorder.O.Update,
		"DELETE /{id}":       procedureroomorder.O.Delete,
		"PATCH /{id}/submit": procedureroomorder.O.Submit,
	})
	hc.RegCrud(r, "/v1/procedure-room-order-item", procedureroomorderitem.O)
	hk.GroupRoutes("/v1/consultation", r, auth.GuardMW, hk.MapHandlerFunc{
		"GET /":             consultation.O.GetList,
		"GET /{id}":         consultation.O.GetDetail,
		"POST /":            consultation.O.Create,
		"PATCH /{id}":       consultation.O.Update,
		"DELETE /{id}":      consultation.O.Delete,
		"PATCH /{id}/reply": consultation.O.Reply,
	})
	hk.GroupRoutes("/v1/chemo", r, auth.GuardMW, hk.MapHandlerFunc{
		"GET /":              chemo.O.GetList,
		"GET /{id}":          chemo.O.GetDetail,
		"POST /":             chemo.O.Create,
		"PATCH /{id}":        chemo.O.Update,
		"DELETE /{id}":       chemo.O.Delete,
		"PATCH /{id}/verify": chemo.O.Verify,
		"PATCH /{id}/reject": chemo.O.Reject,
	})
	hc.RegCrud(r, "/v1/control-letter", controlletter.O)
	hc.RegCrud(r, "/v1/internal-reference", internalreference.O)
	hc.RegCrud(r, "/v1/ambulance-transport-req", ambulancetransportrequest.O)
	hc.RegCrud(r, "/v1/responsible-doctor-hist", responsibledoctorhist.O)
	hc.RegCrud(r, "/v1/adm-employee-hist", admemployeehist.O)
	hk.GroupRoutes("/v1/therapy-protocol", r, auth.GuardMW, hk.MapHandlerFunc{
		"GET /":              therapyprotocol.O.GetList,
		"GET /{id}":          therapyprotocol.O.GetDetail,
		"POST /":             therapyprotocol.O.Create,
		"PATCH /{id}":        therapyprotocol.O.Update,
		"DELETE /{id}":       therapyprotocol.O.Delete,
		"PATCH /{id}/verify": therapyprotocol.O.Verify,
		"PATCH /{id}/reject": therapyprotocol.O.Reject,
	})
	hc.RegCrud(r, "/v1/chemo-protocol", chemoprotocol.O)
	hc.RegCrud(r, "/v1/upload-file", uploadfile.O)
	hc.RegCrud(r, "/v1/encounter-document", encounterdocument.O)
	hc.RegCrud(r, "/v1/general-consent", generalconsent.O)
	r.HandleFunc("POST /v1/generate-file", generatefile.Generate)
	hk.GroupRoutes("/v1/resume", r, auth.GuardMW, hk.MapHandlerFunc{
		"POST /":               resume.Create,
		"GET /":                resume.GetList,
		"GET /{id}":            resume.GetDetail,
		"PATCH /{id}":          resume.Update,
		"DELETE /{id}":         resume.Delete,
		"PATCH /{id}/verify":   resume.Verify,
		"PATCH /{id}/validate": resume.Validate,
	})
	hk.GroupRoutes("/v1/screening", r, auth.GuardMW, hk.MapHandlerFunc{
		"POST /":    screening.O.Create,
		"GET /":     screening.O.GetList,
		"GET /{id}": screening.O.GetDetail,
	})
	/******************** actor ********************/
	hc.RegCrud(r, "/v1/person", person.O)
	hc.RegCrud(r, "/v1/person-address", personaddress.O)
	hc.RegCrud(r, "/v1/person-contact", personcontact.O)
	hc.RegCrud(r, "/v1/person-insurance", personinsurance.O)
	hc.RegCrud(r, "/v1/employee", employee.O)
	hc.RegCrudByCode(r, "/v1/doctor", doctor.O)
	hc.RegCrudByCode(r, "/v1/nurse", nurse.O)
	hc.RegCrudByCode(r, "/v1/nutritionist", nutritionist.O)
	hc.RegCrudByCode(r, "/v1/pharmacist", pharmacist.O)
	hk.GroupRoutes("/v1/user", r, hk.MapHandlerFunc{
		"GET /":              user.O.GetList,
		"GET /{id}":          user.O.GetDetail,
		"POST /":             user.O.Create,
		"PATCH /{id}":        user.O.Update,
		"DELETE /{id}":       user.O.Delete,
		"PATCH /{id}/block":  user.O.Block,
		"PATCH /{id}/active": user.O.Active,
	})
	hc.RegCrud(r, "/v1/user-fes", userfes.O)
	hk.GroupRoutes("/v1/patient", r, auth.GuardMW, hk.MapHandlerFunc{
		"GET /":                     patient.O.GetList,
		"GET /{id}":                 patient.O.GetDetail,
		"POST /":                    patient.O.Create,
		"PATCH /{id}":               patient.O.Update,
		"DELETE /{id}":              patient.O.Delete,
		"GET /search/{keyword}":     patient.O.Search,
		"GET /by-resident-identity": patient.O.SearchByResidentIdentityNumber,
	})

	/******************** sources ********************/
	hc.RegCrudByCode(r, "/v1/division", division.O)
	hc.RegCrudByCode(r, "/v1/division-position", divisionposition.O)
	hc.RegCrudByCode(r, "/v1/installation", installation.O)
	hc.RegCrudByCode(r, "/v1/unit", unit.O)
	hc.RegCrudByCode(r, "/v1/installation-position", installationposition.O)
	hc.RegCrudByCode(r, "/v1/unit-position", unitposition.O)
	hc.RegCrudByCode(r, "/v1/specialist", specialist.O)
	hc.RegCrudByCode(r, "/v1/subspecialist", subspecialist.O)
	hc.RegCrudByCode(r, "/v1/specialist-position", specialistposition.O)
	hc.RegCrudByCode(r, "/v1/subspecialist-position", subspecialistposition.O)
	hc.RegCrudByCode(r, "/v1/infra", infra.O)
	hc.RegCrudByCode(r, "/v1/pharmacy-company", pharmacycompany.O)
	hc.RegCrudByCode(r, "/v1/diagnose-src", diagnosesrc.O)
	hc.RegCrudByCode(r, "/v1/procedure-src", proceduresrc.O)
	hc.RegCrudByCode(r, "/v1/uom", uom.O)
	hc.RegCrudByCode(r, "/v1/item", item.O)
	hc.RegCrud(r, "/v1/item-price", itemprice.O)
	hc.RegCrudByCode(r, "/v1/medicine-group", medicinegroup.O)
	hc.RegCrudByCode(r, "/v1/medicine-method", medicinemethod.O)
	hc.RegCrudByCode(r, "/v1/mcu-src-category", mcusrccategory.O)
	hc.RegCrudByCode(r, "/v1/mcu-src", mcusrc.O)
	hc.RegCrudByCode(r, "/v1/ethnic", ethnic.O)
	hc.RegCrudByCode(r, "/v1/insurance-company", insurancecompany.O)
	hc.RegCrudByCode(r, "/v1/medicine", medicine.O)
	hc.RegCrudByCode(r, "/v1/device", device.O)
	hc.RegCrudByCode(r, "/v1/material", material.O)
	hc.RegCrudByCode(r, "/v1/material-package", materialpackage.O)
	hc.RegCrud(r, "/v1/material-package-item", materialpackageitem.O)
	hc.RegCrud(r, "/v1/doctor-fee", doctorfee.O)
	hc.RegCrudByCode(r, "/v1/medical-action-src", medicalactionsrc.O)
	hc.RegCrud(r, "/v1/medical-action-src-item", medicalactionsrcitem.O)
	hc.RegCrudByCode(r, "/v1/language", language.O)
	hc.RegCrudByCode(r, "/v1/mcu-sub-src", mcusubsrc.O)
	hc.RegCrud(r, "/v1/vehicle", vehicle.O)
	hc.RegCrud(r, "/v1/vehicle-hist", vehiclehist.O)
	hc.RegCrud(r, "/v1/edu-assessment", eduassesment.O)

	hc.RegCrudByCode(r, "/v1/village", village.O)
	hc.RegCrudByCode(r, "/v1/district", district.O)
	hc.RegCrudByCode(r, "/v1/regency", regency.O)
	hc.RegCrudByCode(r, "/v1/province", province.O)
	hc.RegCrudByCode(r, "/v1/postal-region", postalregion.O)

	/******************** BPJS ********************/
	hk.GroupRoutes("/v1/vclaim-sep", r, hk.MapHandlerFunc{
		"POST /":           vclaimsep.O.Create,
		"GET /{number}":    vclaimsep.O.GetDetail,
		"DELETE /{number}": vclaimsep.O.Delete,
	})

	hk.GroupRoutes("/v1/vclaim-sep-hist", r, hk.MapHandlerFunc{
		"GET /": vclaimsephist.O.GetList,
	})

	hk.GroupRoutes("/v1/vclaim-sep-print", r, hk.MapHandlerFunc{
		"POST /": vclaimsepprint.O.Create,
	})

	hk.GroupRoutes("/v1/reference", r, hk.MapHandlerFunc{
		"GET /province":                                 reference.GetListProvince,
		"GET /regency/{provinceCode}":                   reference.GetListCities,
		"GET /district/{regencyCode}":                   reference.GetListDistrict,
		"GET /diagnose/{keyword}":                       reference.GetListDiagnose,
		"GET /diagnose-prb":                             reference.GetListDiagnosePrb,
		"GET /medicine-prb/{keyword}":                   reference.GetListMedicinePrb,
		"GET /unit/{unitCode}":                          reference.GetListUnit,
		"GET /healthcare/{healthcare}/{healthcareType}": reference.GetListHealthcare,
		"GET /responsible-doctor/{serviceType}/{serviceDate}/{specialistCode}": reference.GetListDoctor,
	})

	hk.GroupRoutes("/v1/member", r, hk.MapHandlerFunc{
		"GET /bpjs/{cardNumber}/{sepDate}": member.GetListByBpjsNumber,
		"GET /nik/{nik}/{sepDate}":         member.GetListByNik,
	})

	hk.GroupRoutes("/v1/monitoring", r, hk.MapHandlerFunc{
		"GET /visit/{date}/{serviceType}":              monitoring.GetListVisit,
		"GET /hist/{cardNumber}/{startDate}/{endDate}": monitoring.GetListHist,
	})

	hk.GroupRoutes("/v1/control-plan", r, hk.MapHandlerFunc{
		"GET /{controlType}/{polyCode}/{date}": controlplan.GetList,
	})

	hk.GroupRoutes("/v1/referral", r, hk.MapHandlerFunc{
		"GET /{number}": referral.GetList,
	})

	/////
	return cmw.SetCors(handlerlogger.SetLog(r))
}
