package runner

import (
	"github.com/spf13/cobra"

	"gitlab.com/gitlab-org/cli/internal/cmdutils"
	assignCmd "gitlab.com/gitlab-org/cli/internal/commands/runner/assign"
	deleteCmd "gitlab.com/gitlab-org/cli/internal/commands/runner/delete"
	jobsCmd "gitlab.com/gitlab-org/cli/internal/commands/runner/jobs"
	listCmd "gitlab.com/gitlab-org/cli/internal/commands/runner/list"
	managersCmd "gitlab.com/gitlab-org/cli/internal/commands/runner/managers"
	unassignCmd "gitlab.com/gitlab-org/cli/internal/commands/runner/unassign"
	updateCmd "gitlab.com/gitlab-org/cli/internal/commands/runner/update"
)

func NewCmdRunner(f cmdutils.Factory) *cobra.Command {
	runnerCmd := &cobra.Command{
		Use:   "runner <command> [flags]",
		Short: "Manage GitLab CI/CD runners.",
		Long:  "Manages GitLab CI/CD runners for projects, groups, or the entire instance.\n",
	}

	runnerCmd.AddCommand(assignCmd.NewCmd(f))
	runnerCmd.AddCommand(listCmd.NewCmd(f))
	runnerCmd.AddCommand(managersCmd.NewCmd(f))
	runnerCmd.AddCommand(jobsCmd.NewCmd(f))
	runnerCmd.AddCommand(updateCmd.NewCmd(f))
	runnerCmd.AddCommand(deleteCmd.NewCmd(f))
	runnerCmd.AddCommand(unassignCmd.NewCmd(f))

	return runnerCmd
}
