package api

import (
	"crypto/rand"
	"encoding/hex"
	"net/http"
	"strconv"
)

// ── helpers ──────────────────────────────────────────────────────────────────

func parseTenantID(r *http.Request) (int64, error) {
	return strconv.ParseInt(r.PathValue("id"), 10, 64)
}

// tenantRandomPassword generates a cryptographically random 16-byte hex password.
func tenantRandomPassword() (string, error) {
	b := make([]byte, 16)
	if _, err := rand.Read(b); err != nil {
		return "", err
	}
	return hex.EncodeToString(b), nil
}
