package persistence

import (
	"database/sql/driver"
	"strings"
	"time"
)

const (
	proofHashA = "8f1c2d3e4a5b60718293a4b5c6d7e8f90112233445566778899aabbccddeeff00"
	proofHashB = "00ffeeddccbbaa998877665544332211f09e8d7c6b5a4938271605b4a3e2d1c8f"
)

// sessionRowValues builds one row in exactly the column order sessionSelectColumns
// projects, so the fixture cannot drift from the scanner.
func sessionRowValues(id, userID, proofHash string) []driver.Value {
	now := time.Now().UTC()
	stamp := now.Format("2006-01-02 15:04:05")
	return []driver.Value{
		id, userID, "stored-bearer", nil,
		// ExpiresAt scans into time.Time; the trailing timestamps scan as raw bytes.
		now, "203.0.113.7", "test-agent",
		false, uint64(1),
		proofHash,
		stamp,
		nil, nil, nil,
		stamp, stamp,
	}
}

func containsColumn(columns []string, want string) bool {
	for _, c := range columns {
		if strings.EqualFold(c, want) {
			return true
		}
	}
	return false
}
