package postgres

import (
	"database/sql"

	"chat-switchboard/store"
)

// NewStores creates all Postgres store implementations and wires them
// into the Stores bundle. Call this at startup after database.Connect().
func NewStores(db *sql.DB) store.Stores {
	SetDB(db)
	return store.Stores{
		Providers:      NewProviderStore(),
		Catalog:        NewCatalogStore(),
		Personas:       NewPersonaStore(),
		Policies:       NewPolicyStore(),
		UserSettings:   NewUserModelSettingsStore(),
		Users:          NewUserStore(),
		Teams:          NewTeamStore(),
		Channels:       NewChannelStore(),
		Messages:       NewMessageStore(),
		Audit:          NewAuditStore(),
		Notes:          NewNoteStore(),
		NoteLinks:      NewNoteLinkStore(),
		GlobalConfig:   NewGlobalConfigStore(),
		Usage:          NewUsageStore(),
		Pricing:        NewPricingStore(),
		Files:          NewFileStore(),
		KnowledgeBases: NewKnowledgeBaseStore(),
		Groups:         NewGroupStore(),
		ResourceGrants: NewResourceGrantStore(),
		Memories:       NewMemoryStore(),
		Projects:       NewProjectStore(),
		Notifications:  NewNotificationStore(),
		NotifPrefs:     NewNotificationPreferenceStore(),
		Workspaces:     NewWorkspaceStore(),
		GitCredentials: &GitCredentialStore{},
		CapOverrides:   NewCapOverrideStore(db),
		RoutingPolicies: NewRoutingPolicyStore(db),
		Sessions:        NewSessionStore(),
		Packages:        NewPackageStore(),
		Workflows:       NewWorkflowStore(),
		Tasks:           NewTaskStore(),
		Presence:        NewPresenceStore(),
		PersonaGroups:   NewPersonaGroupStore(),
		Folders:         NewFolderStore(),
		Health:          NewHealthStore(db),
		ExtPermissions:  NewExtensionPermissionStore(db),
		ExtData:         NewExtDataStore(db),
		Tickets:         NewTicketStore(),
		RateLimits:      NewRateLimitStore(),
		Export:          NewExportStore(),
	}
}
