package adapter

import (
	"context"
)

type TenantPlanInfo struct {
	TenantID      uint   `json:"tenant_id"`
	EffectivePlan string `json:"effective_plan"`
}

type ActionCheckReq struct {
	Resource Resource `json:"resource"`
	Action   string   `json:"action"`
}
type Resource struct {
	Type       string `json:"type"`
	InstanceID string `json:"instance_id"`
	Region     string `json:"region"`
	Provider   string `json:"provider"`
	IsFree     bool   `json:"is_free"`
}

const (
	BillingResourceTypeServerlessCluster = "serverless_cluster"
	BillingResourceTypeEssentialCluster  = "essential_cluster"
)

type ActionCheckResp struct {
	Pass bool `json:"pass"`
	// Reason is the reason why the action is not allowed.
	Reason string `json:"reason"`
}

// {"pass": true, "reason": ""}

//go:generate go run go.uber.org/mock/mockgen@latest -source=$GOFILE -package=mock_$GOPACKAGE -destination=./mock_$GOPACKAGE/mock_$GOFILE
type BillingService interface {
	GetPlans(ctx context.Context, id uint64) (*TenantPlanInfo, error)
	CanCreateScalableCluster(ctx context.Context, region, provider, resourceType string, tenantId uint64) (*ActionCheckResp, error)
}
