// Copyright 2018 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// See the License for the specific language governing permissions and
// limitations under the License.

package provisioner

import "github.com/pingcap/tidb-enterprise/installer/tep-operator/pkg/apis/pingcap.com/v1alpha1"

// A provisioner is responsible for completing some tasks
type Provisioner interface {
	// Prepare is called with a set of configurations to setup the
	// internal state of the provisioner.
	Prepare(*v1alpha1.TepCluster) error

	// Provision is called to actually execute tasks.
	Provision(*v1alpha1.TepCluster) error

	// Cancel is called to cancel the provisioning. This is usually called
	// while Provision is still being called. The Provisioner should act
	// to stop its execution as quickly as possible.
	Cancel() error

	// GetProvisionStatus return the provisioner status
	GetProvisionerStatus() ProvisionerStatus
}

// ProvisionStatus represents the current status of provisioner
type ProvisionerStatus struct {
	Phase v1alpha1.TepClusterDeployPhase
}
