package worker

import (
	"github.com/pingcap/dbaas/central/db/entity"
	"github.com/pingcap/dbaas/central/db/tenant"
	"github.com/pingcap/dbaas/central/model/billing"
	"github.com/pingcap/dbaas/central/model/cluster"
)

type BgContext struct {
	BgModel
	billing.Context
}

type BgModel struct {
	billing.Model
	clusterModel cluster.Model
}

func NewModel(model billing.Model, clusterModel cluster.Model) BgModel {
	return BgModel{
		Model:        model,
		clusterModel: clusterModel,
	}
}

func (m BgModel) BgContext(tenantID entity.ID) BgContext {
	return BgContext{
		BgModel: m,
		Context: m.User(&tenant.User{TenantID: tenantID}),
	}
}
