package auth

import "strings"

// BuiltInBrowserClientID is the immutable ConsumerKey of the platform-owned
// browser client. Its database row ID is deployment-specific, so consumers
// must resolve this key through the Connected App source of truth before
// comparing a session's ConnectedAppId.
const BuiltInBrowserClientID = "nexuscrm-ui"

// IsInteractiveBrowserSession is the shared contract for first-party browser
// sessions that may use interactive-only flows such as authorize continuation
// and same-origin bearer renewal.
func IsInteractiveBrowserSession(sessionClass, scope, connectedAppID, grantType string) bool {
	if strings.TrimSpace(sessionClass) == OAuthSessionClassPlatformBrowser {
		return true
	}
	if strings.TrimSpace(sessionClass) != "" {
		return false
	}
	if strings.TrimSpace(scope) != "" {
		return false
	}
	return strings.TrimSpace(connectedAppID) == "" && strings.TrimSpace(grantType) == ""
}
