package controls

import (
	"fmt"
)

// NewDeprecatedReplacedCommand declares the deprecated command that has an alternative command.
func NewDeprecatedReplacedCommand(command, newCommand string) *Control {
	return &Control{
		Name:        command,
		Description: "replaced with: " + newCommand,
		Error: fmt.Errorf(
			"the `%s` command is no longer supported, use `%s` instead",
			command,
			newCommand,
		),
		Warning: fmt.Sprintf(
			"The `%s` command is deprecated and will be removed in a future version of Terragrunt. Use `%s` instead.",
			command,
			newCommand,
		),
	}
}

// NewDeprecatedCommand declares the deprecated command.
func NewDeprecatedCommand(command string) *Control {
	return &Control{
		Name:        command,
		Description: "no replaced command",
		Error:       fmt.Errorf("the `%s` command is no longer supported", command),
		Warning: fmt.Sprintf(
			"The `%s` command is deprecated and will be removed in a future version of Terragrunt.",
			command,
		),
	}
}
