package domain

import "time"

// CacheCredentials represents isolated cache access for a project.
// Uses Redis ACLs to scope access to project-specific key prefix.
type CacheCredentials struct {
	ProjectID  string    `json:"project_id" db:"project_id"`
	URL        string    `json:"url" db:"url"`                 // redis://user:pass@host:port
	URLStaging string    `json:"url_staging" db:"url_staging"` // staging connection (same for now)
	Prefix     string    `json:"prefix" db:"prefix"`           // project:{id}:
	Username   string    `json:"username" db:"username"`       // proj-{id}
	Host       string    `json:"host" db:"host"`               // redis.databases.svc
	Port       int       `json:"port" db:"port"`               // 6379
	CreatedAt  time.Time `json:"created_at" db:"created_at"`
}

// CacheConfig holds cache provisioning configuration.
type CacheConfig struct {
	// AdminHost is the Redis host for admin operations
	AdminHost string
	// AdminPort is the Redis port
	AdminPort int
	// AdminPassword is the password for the default/admin user
	AdminPassword string
	// KeyPrefix is the base prefix for all project keys (e.g., "project:")
	KeyPrefix string
	// DefaultTTL is the default TTL for cached items (0 = no default TTL)
	DefaultTTL time.Duration
}
