package message

import "strings"

const (
	// ChannelSubsystemIM is the ordinary user-visible messaging surface.
	ChannelSubsystemIM = "im"
	// ChannelSubsystemTeam is the Agent Team-owned default channel surface.
	ChannelSubsystemTeam = "team"
	// ChannelSubsystemTutorial is the private Desktop Quick Start channel surface.
	ChannelSubsystemTutorial = "tutorial"
	// ChannelSubsystemAgentSession is the legacy DB subsystem value used for hidden agent-thread/session carriers.
	ChannelSubsystemAgentSession = "kb"
	// ChannelSubsystemKB is kept as a compatibility alias for API payloads and legacy tests.
	ChannelSubsystemKB = ChannelSubsystemAgentSession
)

// NormalizeChannelSubsystem keeps old callers and rows on the ordinary IM
// surface while allowing product-owned hidden carriers to opt into a subsystem.
func NormalizeChannelSubsystem(raw string) string {
	switch strings.ToLower(strings.TrimSpace(raw)) {
	case ChannelSubsystemTeam:
		return ChannelSubsystemTeam
	case ChannelSubsystemTutorial:
		return ChannelSubsystemTutorial
	case ChannelSubsystemAgentSession:
		return ChannelSubsystemAgentSession
	default:
		return ChannelSubsystemIM
	}
}
