package utils

import (
	"time"

	"github.com/gofiber/fiber/v2"
	"github.com/rs/zerolog/log"
)

func GetXAuhorizationHeader(c *fiber.Ctx) string {
	return c.GetReqHeaders()[HeaderXAuthorization]
}

func GetXApiKeyHeader(c *fiber.Ctx) string {
	return c.GetReqHeaders()[HeaderXApiKey]
}

func GetSessionExpiresAtTime() time.Time {
	return time.Now().Add(time.Second * SessionExpiresAtTime)
}

func IsPasswordLengthValid(password string) bool {
	lenPassword := len(password)

	if lenPassword < MinPassword || lenPassword > MaxPassword {
		log.Error().Msg("Password length not valid")
		return false
	}

	return true
}
