package services

import "github.com/nexuscrm/kernel/pkg/ports"

// AuthorizationGrantRepositoryContract exposes the optional generic grant
// authority to a product composition root. OAuthRepository predates the grant
// contract, so retain its wider historical type internally and fail closed for
// products that opt into grant lifecycle bindings without the new capability.
func (sm *ServiceManager) AuthorizationGrantRepositoryContract() ports.AuthorizationGrantRepository {
	if sm == nil || sm.deps.OAuthRepo == nil {
		return nil
	}
	grants, ok := sm.deps.OAuthRepo.(ports.AuthorizationGrantRepository)
	if !ok {
		return nil
	}
	return grants
}
