package initialize

import (
	"context"

	"kra/internal/biz"
	"kra/internal/conf"

	"gorm.io/gorm"
)

// Backend is the infrastructure boundary required by application
// initialization and runtime configuration management.
type Backend interface {
	IsInitialized(context.Context) (bool, error)
	InitializeDatabase(context.Context, *biz.DatabaseConfig, func(context.Context, *gorm.DB) error) error
	PersistConfig(context.Context) error
	PersistAdminConfig(context.Context, []byte) error
	PersistRuntimeConfig(context.Context, []byte, []byte) error
	ReloadConfig(context.Context) error
	RuntimeValues() (*conf.Data, *conf.AdminBackend)
	RuntimeAdmin() *conf.AdminBackend
	RefreshDatabaseSources(*conf.Data) error
}
