package service

import (
	"context"

	"github.com/tidbcloud/pkgv2/bizerr"
	"github.com/tidbcloud/serverless-service/internal/config"
	"github.com/tidbcloud/serverless-service/internal/domain/vo"
)

// ListChangefeedSpecifications returns the user-facing rcu tier ladder
// from cdc.newArch.rcuTiers (UI calls this so customers can pick a
// tier). clusterID is accepted to match the API
// `GET /clusters/{cluster_id}/changefeeds:listSpecifications` shape — for now
// the ladder is dataplane-wide, not per-cluster, so the id is not used
// for filtering. Tier order is preserved verbatim.
//
// Machine-shape catalog (cdc.newArch.instanceTypes) is an ops-internal
// dimension and NOT returned here.
func (s *cdcService) ListChangefeedSpecifications(
	_ context.Context,
	_ string,
) ([]*vo.ChangefeedSpecification, bizerr.BizError) {
	tiers := config.NewArchRcuTiers()
	out := make([]*vo.ChangefeedSpecification, 0, len(tiers))
	for i := range tiers {
		out = append(out, vo.ChangefeedSpecificationFromConfig(tiers[i]))
	}
	return out, nil
}
