package push

import (
	
)

// Registry manages push notification handlers
type Registry struct {
	mu        sync.RWMutex
	handlers  map[string]NotificationHandler
	protected map[string]bool
}

// NewRegistry creates a new push notification registry
func () *Registry {
	return &Registry{
		handlers:  make(map[string]NotificationHandler),
		protected: make(map[string]bool),
	}
}

// RegisterHandler registers a handler for a specific push notification name
func ( *Registry) ( string,  NotificationHandler,  bool) error {
	if  == nil {
		return ErrHandlerNil
	}

	.mu.Lock()
	defer .mu.Unlock()

	// Check if handler already exists
	if ,  := .protected[];  {
		return ErrHandlerExists()
	}

	.handlers[] = 
	.protected[] = 
	return nil
}

// GetHandler returns the handler for a specific push notification name
func ( *Registry) ( string) NotificationHandler {
	.mu.RLock()
	defer .mu.RUnlock()
	return .handlers[]
}

// UnregisterHandler removes a handler for a specific push notification name
func ( *Registry) ( string) error {
	.mu.Lock()
	defer .mu.Unlock()

	// Check if handler is protected
	if ,  := .protected[];  &&  {
		return ErrProtectedHandler()
	}

	delete(.handlers, )
	delete(.protected, )
	return nil
}