package versioncheck

// Code generated by gowrap. DO NOT EDIT.
// template: ../../templates/versioncheck.tmpl
// gowrap: http://github.com/hexdigest/gowrap

import (
	"context"

	"github.com/uber/cadence/common/client"
	"github.com/uber/cadence/common/types"
	"github.com/uber/cadence/service/frontend/api"
	"github.com/uber/cadence/service/frontend/config"
)

type (
	versionCheckHandler struct {
		frontendHandler api.Handler
		config          *config.Config
		versionChecker  client.VersionChecker
	}
)

func NewAPIHandler(
	wfHandler api.Handler,
	config *config.Config,
	versionChecker client.VersionChecker,
) api.Handler {
	return &versionCheckHandler{
		frontendHandler: wfHandler,
		config:          config,
		versionChecker:  versionChecker,
	}
}

func (h *versionCheckHandler) CountWorkflowExecutions(ctx context.Context, cp1 *types.CountWorkflowExecutionsRequest) (cp2 *types.CountWorkflowExecutionsResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.CountWorkflowExecutions(ctx, cp1)
}

func (h *versionCheckHandler) DeleteDomain(ctx context.Context, dp1 *types.DeleteDomainRequest) (err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.DeleteDomain(ctx, dp1)
}

func (h *versionCheckHandler) DeprecateDomain(ctx context.Context, dp1 *types.DeprecateDomainRequest) (err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.DeprecateDomain(ctx, dp1)
}

func (h *versionCheckHandler) DescribeDomain(ctx context.Context, dp1 *types.DescribeDomainRequest) (dp2 *types.DescribeDomainResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.DescribeDomain(ctx, dp1)
}

func (h *versionCheckHandler) DescribeTaskList(ctx context.Context, dp1 *types.DescribeTaskListRequest) (dp2 *types.DescribeTaskListResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.DescribeTaskList(ctx, dp1)
}

func (h *versionCheckHandler) DescribeWorkflowExecution(ctx context.Context, dp1 *types.DescribeWorkflowExecutionRequest) (dp2 *types.DescribeWorkflowExecutionResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.DescribeWorkflowExecution(ctx, dp1)
}

func (h *versionCheckHandler) DiagnoseWorkflowExecution(ctx context.Context, dp1 *types.DiagnoseWorkflowExecutionRequest) (dp2 *types.DiagnoseWorkflowExecutionResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.DiagnoseWorkflowExecution(ctx, dp1)
}

func (h *versionCheckHandler) FailoverDomain(ctx context.Context, fp1 *types.FailoverDomainRequest) (fp2 *types.FailoverDomainResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.FailoverDomain(ctx, fp1)
}

func (h *versionCheckHandler) GetClusterInfo(ctx context.Context) (cp1 *types.ClusterInfo, err error) {
	return h.frontendHandler.GetClusterInfo(ctx)
}

func (h *versionCheckHandler) GetSearchAttributes(ctx context.Context) (gp1 *types.GetSearchAttributesResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.GetSearchAttributes(ctx)
}

func (h *versionCheckHandler) GetTaskListsByDomain(ctx context.Context, gp1 *types.GetTaskListsByDomainRequest) (gp2 *types.GetTaskListsByDomainResponse, err error) {
	return h.frontendHandler.GetTaskListsByDomain(ctx, gp1)
}

func (h *versionCheckHandler) GetWorkflowExecutionHistory(ctx context.Context, gp1 *types.GetWorkflowExecutionHistoryRequest) (gp2 *types.GetWorkflowExecutionHistoryResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.GetWorkflowExecutionHistory(ctx, gp1)
}

func (h *versionCheckHandler) Health(ctx context.Context) (hp1 *types.HealthStatus, err error) {
	return h.frontendHandler.Health(ctx)
}

func (h *versionCheckHandler) ListArchivedWorkflowExecutions(ctx context.Context, lp1 *types.ListArchivedWorkflowExecutionsRequest) (lp2 *types.ListArchivedWorkflowExecutionsResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.ListArchivedWorkflowExecutions(ctx, lp1)
}

func (h *versionCheckHandler) ListClosedWorkflowExecutions(ctx context.Context, lp1 *types.ListClosedWorkflowExecutionsRequest) (lp2 *types.ListClosedWorkflowExecutionsResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.ListClosedWorkflowExecutions(ctx, lp1)
}

func (h *versionCheckHandler) ListDomains(ctx context.Context, lp1 *types.ListDomainsRequest) (lp2 *types.ListDomainsResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.ListDomains(ctx, lp1)
}

func (h *versionCheckHandler) ListOpenWorkflowExecutions(ctx context.Context, lp1 *types.ListOpenWorkflowExecutionsRequest) (lp2 *types.ListOpenWorkflowExecutionsResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.ListOpenWorkflowExecutions(ctx, lp1)
}

func (h *versionCheckHandler) ListTaskListPartitions(ctx context.Context, lp1 *types.ListTaskListPartitionsRequest) (lp2 *types.ListTaskListPartitionsResponse, err error) {
	return h.frontendHandler.ListTaskListPartitions(ctx, lp1)
}

func (h *versionCheckHandler) ListWorkflowExecutions(ctx context.Context, lp1 *types.ListWorkflowExecutionsRequest) (lp2 *types.ListWorkflowExecutionsResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.ListWorkflowExecutions(ctx, lp1)
}

func (h *versionCheckHandler) PollForActivityTask(ctx context.Context, pp1 *types.PollForActivityTaskRequest) (pp2 *types.PollForActivityTaskResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.PollForActivityTask(ctx, pp1)
}

func (h *versionCheckHandler) PollForDecisionTask(ctx context.Context, pp1 *types.PollForDecisionTaskRequest) (pp2 *types.PollForDecisionTaskResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.PollForDecisionTask(ctx, pp1)
}

func (h *versionCheckHandler) QueryWorkflow(ctx context.Context, qp1 *types.QueryWorkflowRequest) (qp2 *types.QueryWorkflowResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.QueryWorkflow(ctx, qp1)
}

func (h *versionCheckHandler) RecordActivityTaskHeartbeat(ctx context.Context, rp1 *types.RecordActivityTaskHeartbeatRequest) (rp2 *types.RecordActivityTaskHeartbeatResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.RecordActivityTaskHeartbeat(ctx, rp1)
}

func (h *versionCheckHandler) RecordActivityTaskHeartbeatByID(ctx context.Context, rp1 *types.RecordActivityTaskHeartbeatByIDRequest) (rp2 *types.RecordActivityTaskHeartbeatResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.RecordActivityTaskHeartbeatByID(ctx, rp1)
}

func (h *versionCheckHandler) RefreshWorkflowTasks(ctx context.Context, rp1 *types.RefreshWorkflowTasksRequest) (err error) {
	return h.frontendHandler.RefreshWorkflowTasks(ctx, rp1)
}

func (h *versionCheckHandler) RegisterDomain(ctx context.Context, rp1 *types.RegisterDomainRequest) (err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.RegisterDomain(ctx, rp1)
}

func (h *versionCheckHandler) RequestCancelWorkflowExecution(ctx context.Context, rp1 *types.RequestCancelWorkflowExecutionRequest) (err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.RequestCancelWorkflowExecution(ctx, rp1)
}

func (h *versionCheckHandler) ResetStickyTaskList(ctx context.Context, rp1 *types.ResetStickyTaskListRequest) (rp2 *types.ResetStickyTaskListResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.ResetStickyTaskList(ctx, rp1)
}

func (h *versionCheckHandler) ResetWorkflowExecution(ctx context.Context, rp1 *types.ResetWorkflowExecutionRequest) (rp2 *types.ResetWorkflowExecutionResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.ResetWorkflowExecution(ctx, rp1)
}

func (h *versionCheckHandler) RespondActivityTaskCanceled(ctx context.Context, rp1 *types.RespondActivityTaskCanceledRequest) (err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.RespondActivityTaskCanceled(ctx, rp1)
}

func (h *versionCheckHandler) RespondActivityTaskCanceledByID(ctx context.Context, rp1 *types.RespondActivityTaskCanceledByIDRequest) (err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.RespondActivityTaskCanceledByID(ctx, rp1)
}

func (h *versionCheckHandler) RespondActivityTaskCompleted(ctx context.Context, rp1 *types.RespondActivityTaskCompletedRequest) (err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.RespondActivityTaskCompleted(ctx, rp1)
}

func (h *versionCheckHandler) RespondActivityTaskCompletedByID(ctx context.Context, rp1 *types.RespondActivityTaskCompletedByIDRequest) (err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.RespondActivityTaskCompletedByID(ctx, rp1)
}

func (h *versionCheckHandler) RespondActivityTaskFailed(ctx context.Context, rp1 *types.RespondActivityTaskFailedRequest) (err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.RespondActivityTaskFailed(ctx, rp1)
}

func (h *versionCheckHandler) RespondActivityTaskFailedByID(ctx context.Context, rp1 *types.RespondActivityTaskFailedByIDRequest) (err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.RespondActivityTaskFailedByID(ctx, rp1)
}

func (h *versionCheckHandler) RespondDecisionTaskCompleted(ctx context.Context, rp1 *types.RespondDecisionTaskCompletedRequest) (rp2 *types.RespondDecisionTaskCompletedResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.RespondDecisionTaskCompleted(ctx, rp1)
}

func (h *versionCheckHandler) RespondDecisionTaskFailed(ctx context.Context, rp1 *types.RespondDecisionTaskFailedRequest) (err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.RespondDecisionTaskFailed(ctx, rp1)
}

func (h *versionCheckHandler) RespondQueryTaskCompleted(ctx context.Context, rp1 *types.RespondQueryTaskCompletedRequest) (err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.RespondQueryTaskCompleted(ctx, rp1)
}

func (h *versionCheckHandler) RestartWorkflowExecution(ctx context.Context, rp1 *types.RestartWorkflowExecutionRequest) (rp2 *types.RestartWorkflowExecutionResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.RestartWorkflowExecution(ctx, rp1)
}

func (h *versionCheckHandler) ScanWorkflowExecutions(ctx context.Context, lp1 *types.ListWorkflowExecutionsRequest) (lp2 *types.ListWorkflowExecutionsResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.ScanWorkflowExecutions(ctx, lp1)
}

func (h *versionCheckHandler) SignalWithStartWorkflowExecution(ctx context.Context, sp1 *types.SignalWithStartWorkflowExecutionRequest) (sp2 *types.StartWorkflowExecutionResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.SignalWithStartWorkflowExecution(ctx, sp1)
}

func (h *versionCheckHandler) SignalWithStartWorkflowExecutionAsync(ctx context.Context, sp1 *types.SignalWithStartWorkflowExecutionAsyncRequest) (sp2 *types.SignalWithStartWorkflowExecutionAsyncResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.SignalWithStartWorkflowExecutionAsync(ctx, sp1)
}

func (h *versionCheckHandler) SignalWorkflowExecution(ctx context.Context, sp1 *types.SignalWorkflowExecutionRequest) (err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.SignalWorkflowExecution(ctx, sp1)
}

func (h *versionCheckHandler) StartWorkflowExecution(ctx context.Context, sp1 *types.StartWorkflowExecutionRequest) (sp2 *types.StartWorkflowExecutionResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.StartWorkflowExecution(ctx, sp1)
}

func (h *versionCheckHandler) StartWorkflowExecutionAsync(ctx context.Context, sp1 *types.StartWorkflowExecutionAsyncRequest) (sp2 *types.StartWorkflowExecutionAsyncResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.StartWorkflowExecutionAsync(ctx, sp1)
}

func (h *versionCheckHandler) TerminateWorkflowExecution(ctx context.Context, tp1 *types.TerminateWorkflowExecutionRequest) (err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.TerminateWorkflowExecution(ctx, tp1)
}

func (h *versionCheckHandler) UpdateDomain(ctx context.Context, up1 *types.UpdateDomainRequest) (up2 *types.UpdateDomainResponse, err error) {
	err = h.versionChecker.ClientSupported(ctx, h.config.EnableClientVersionCheck())
	if err != nil {
		return
	}
	return h.frontendHandler.UpdateDomain(ctx, up1)
}
