package flow

import (
	"database/sql"
	"flag"
	"validate/dbctrl"
)

const EstimatePrimaryClusterCommand = "estimate"
const VerifyDownstreamClusterCommand = "verify"
const MakeupDownstreamClusterCommand = "makeup"
const ShowAllMigrationStepsCommand = "steps"
const ShowHelpCommand = "help"

const CommandTargetAll = "all"
const CommandTargetDBAccount = "account"
const CommandTargetSchema = "schema"
const CommandTargetGlobalVariable = "global-variable"
const CommandTargetConfiguration = "config"
const CommandTargetPlacementRule = "placement-rule"
const CommandTargetSQLBinding = "binding"

const PrefixPrimaryClusterAddr = "primary-"
const PrefixDownstreamClusterAddr = "downstream-"

type ClusterMigrationSubCommandCtx struct {
	fs *flag.FlagSet

	CommandTarget string

	PrimaryAddress    dbctrl.DBAddress
	PrimaryDBConnPool *dbctrl.DBConnPool
	PrimaryDBConn     *sql.DB
	// PrimaryTransaction *sql.Tx

	DownstreamAddress    dbctrl.DBAddress
	DownstreamDBConnPool *dbctrl.DBConnPool
	DownstreamDBConn     *sql.DB
	// DownstreamTransaction *sql.Tx
}

type ClusterMigrationSubCommand interface {
	Name() string
	Init([]string) error
	Execute() error
}
