package kok

import (
	fiko_mongo "server/sistem/fikoyt_mongo"

	"github.com/gofiber/contrib/monitor"
	"github.com/gofiber/fiber/v3"
	"github.com/gofiber/fiber/v3/middleware/cors"
	"github.com/gofiber/fiber/v3/middleware/session"
	"github.com/gofiber/fiber/v3/middleware/static"
)

func KokRouting(app *fiber.App) {

	app.Use("/", static.New("./statik"))

	app.Get("/", func(c fiber.Ctx) error {
		// panic("asdasda")
		// user := c.Locals("FikoYT").(fiber.Map)
		session := c.Locals("session").(*session.Session)

		s, err := fiko_mongo.GetSessionData(session, "test")
		if err != nil {

		}

		return c.Status(200).JSON(s)
	})

	///
	app.Get("/metrics", monitor.New(monitor.Config{Title: "FikoYT Metrikler"}))

	///
	fapiv1 := app.Group("/fapiv1")

	fapiv1.Use(cors.New(cors.Config{
		AllowOrigins:     []string{"https://fikoyt.com:444", "https://fikoyt.com:9000"},                 // String dilimi olarak belirt
		AllowMethods:     []string{"GET", "POST", "HEAD", "PUT", "DELETE", "PATCH", "OPTIONS", "TRACE"}, // İzin verilen HTTP metodları
		AllowHeaders:     []string{"*", "Content-Type", "Authorization", "Mode", "cihaz_kimlik", "cihaz_bilgi", "uygulama", "access-control-allow-origin", "access-control-allow-credentials", "cihaz_tipi", "Content-Type", "X-Requested-With"},
		AllowCredentials: true, AllowPrivateNetwork: true, ExposeHeaders: []string{"*", "Content-Length", "Content-Type", "X-Requested-With"},
	}))

	fapiv1.Post("/fikoyt.com.test", fikoyt_sistem_test)

	fapiv1.Post("/fikoyt.com.FikoYT.sistem.uye.ol", fikoyt_sistem_uye_ol)

	fapiv1.Post("/fikoyt.com.FikoYT.sistem.giris.yap", fikoyt_sistem_giris_yap)

	fapiv1.Post("/fikoyt.com.FikoYT.sistem.cikis.yap", fikoyt_sistem_cikis_yap)

	fapiv1.Get("/fikoyt.com.FikoYT.sistem.dosyalar.:id.resim", fikoyt_sistem_dosyalar_id_resim)

	fapiv1.Get("/fikoyt.com.FikoYT.sistem.kullanici.:kid.profilResmi", fikoyt_sistem_kullanici_profil_resmi)

	fapiv1.Post("/fikoyt.com.FikoYT.sistem.kullanici.:kid.profilResmi.degistir", fikoyt_sistem_kullanici_profil_resmi_degistir)

	fapiv1.Post("/fikoyt.com.FikoYT.sistem.kullanici.:kid.profilResmi.degistir", fikoyt_sistem_kullanici_profil_resmi_sil)

	fapiv1.Post("/fikoyt.com.FikoYT.sistem.aktif-kullanici.bilgi", fikoyt_sistem_aktif_kullanici_bilgi)

	fapiv1.Get("/fikoyt.com.FikoYT.sistem.aktif-kullanici.profilResmi", fikoyt_sistem_aktif_kullanici_profil_resmi)

	fapiv1.Get("/fikoyt.com.FikoYT.sistem.windows.guncelleme.bilgi", fikoyt_sistem_bilgi_guncelleme)
}
