package session

import (
	"crypto/rsa"
	"encoding/gob"
	"time"

	"github.com/alexedwards/scs/v2"
	"golang.org/x/oauth2"
)

// type SCS struct {
// 	*scs.SessionManager
// }
// type Data struct {
// 	Ctx   context.Context
// 	Token string
// 	Req   *http.Request
// }

var Manager *scs.SessionManager

func init() {
	gob.RegisterName("oauth2_token_pointer", &oauth2.Token{})
	gob.RegisterName("rsa_public_key_pointer", &rsa.PublicKey{})
	Manager = scs.New()
	Manager.Lifetime = 24 * time.Hour
	Manager.Cookie.Name = "session_cookie"
	// Manager.Cookie.Secure = true   // Set to true in production
	// Manager.Store = memstore.New() // Or use another store (e.g., Redis, database)
}

// func (s *SCS) UpdateHttpRequest(r *http.Request) context.Context {
// 	sessToken := Manager.Token(r.Context())
// 	sess, err := Manager.Load(r.Context(), sessToken)
// 	if err != nil {
// 		log.Println(err.Error())
// 	}
// 	s.SessionManager = sess
// 	return
// }
