package node

import (
	"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/commonflags"
	"github.com/spf13/cobra"
	"github.com/spf13/viper"
)

var RemoveCmd = &cobra.Command{
	Use:   "remove-nodes key1 [key2 [...]]",
	Short: "Remove storage nodes from the netmap",
	Long:  `Move nodes to the Offline state in the candidates list and tick an epoch to update the netmap`,
	PreRun: func(cmd *cobra.Command, _ []string) {
		_ = viper.BindPFlag(commonflags.AlphabetWalletsFlag, cmd.Flags().Lookup(commonflags.AlphabetWalletsFlag))
		_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
	},
	RunE: RemoveNodesCmd,
}

func initRemoveNodesCmd() {
	RemoveCmd.Flags().String(commonflags.AlphabetWalletsFlag, "", commonflags.AlphabetWalletsFlagDesc)
	RemoveCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
	RemoveCmd.Flags().String(commonflags.LocalDumpFlag, "", "Path to the blocks dump file")
}

func init() {
	initRemoveNodesCmd()
}