package schema

import "fmt"

// TenantID identifies a tenant in the migration pipeline.
//
// Opaque string: may be a bare account ID ("42") or an account:cluster pair
// ("1001:0"). Carried verbatim into URLs and JSON — no percent-encoding.
type TenantID string

// ShardID is a tenant-scoped shard identifier formatted as "<tenant>:<idx>".
//
// Construct via NewShardID; do not concatenate raw strings.
type ShardID string

// NewShardID constructs a ShardID from a tenant and a 0-based shard index.
//
// Returns an empty ShardID if tenant is empty or idx is negative — both
// indicate a programmer bug.
func NewShardID(tenant TenantID, idx int) ShardID {
	if tenant == "" || idx < 0 {
		return ""
	}
	return ShardID(fmt.Sprintf("%s:%d", tenant, idx))
}
