# Path: pushkin/sender/nordifier/constants.py
# SN_GUEST = 0
# SN_FACEBOOK = 1
# SN_GOOGLE = 2
# PLATFORM_ANDROID = 1
# PLATFORM_IPHONE = 2
# PLATFORM_IPAD = 5
# PLATFORM_ANDROID_TABLET = 6
# PLATFORM_BY_PROVIDER = {
#     PLATFORM_ANDROID: 1,
#     PLATFORM_ANDROID_TABLET: 1,
#     PLATFORM_IPHONE: 2,
#     PLATFORM_IPAD: 2,
# }
# NOTIFICATION_CONTROL_GROUP = -2
# NOTIFICATION_READY = -1
# NOTIFICATION_SUCCESS = 0
# NOTIFICATION_UNKNOWN_ERROR = 1
# NOTIFICATION_CONNECTION_ERROR = 2
# NOTIFICATION_EXPIRED = 3
# NOTIFICATION_UNKNOWN_PLATFORM = 4
# NOTIFICATION_SENDER_QUEUE_LIMIT = 5
# NOTIFICATION_GCM_FATAL_ERROR = 100
# NOTIFICATION_GCM_UNAVAILABLE = 101
# NOTIFICATION_GCM_INVALID_REGISTRATION_ID = 102
# NOTIFICATION_GCM_DEVICE_UNREGISTERED = 103
# NOTIFICATION_APNS_MALFORMED_ERROR = 200
# NOTIFICATION_APNS_DEVICE_UNREGISTERED = 201
# TIME_TO_LIVE_HOURS = 6
# 
# Path: pushkin/sender/senders.py
# class NotificationSender(ProcessPool):
# class NotificationOperation():
# class NotificationPostProcessor(Thread):
# class NotificationStatistics:
# class ApnNotificationSender(NotificationSender):
# class GcmNotificationSender(NotificationSender):
#     NUM_WORKERS_DEFAULT = 50
#     UPDATE_CANONICALS = 1
#     UPDATE_UNREGISTERED_DEVICES = 2
#     OPERATION_QUEUE = multiprocessing.Queue()
#     PLATFORMS = (constants.PLATFORM_IPHONE,
#                  constants.PLATFORM_IPAD)
#     PLATFORMS = (constants.PLATFORM_ANDROID,
#                  constants.PLATFORM_ANDROID_TABLET)
#     def __init__(self, **kwargs):
#     def limit_exceeded(self, notification):
#     def queue_size(self):
#     def log_notifications(self, notifications):
#     def __init__(self, operation, data):
#     def __init__(self):
#     def queue_size(self):
#     def update_canonicals(self, canonical_ids):
#     def update_unregistered_devices(self, unregistered_devices):
#     def run(self):
#     def __init__(self, name, logger, last_averages=100, log_time_seconds=30):
#     def start(self):
#     def stop(self):
#     def process(self):
#     def process(self):
# 
# Path: pushkin/context.py
# PERSIST_LOGGER_PREFFIX = 'persist_'
# def setup_loggers():
# def setup_configuration(configuration_filename):
# def start_processors():
# 
# Path: pushkin/config.py
# DATABASE_CONFIG_SECTION = 'Database'
# SERVER_SPECIFIC_CONFIG_SECTION = 'ServerSpecific'
# EVENT_CONFIG_SECTION = 'Event'
# LOG_CONFIG_SECTION = 'Log'
# SERVER_CONFIG_SECTION = 'Server'
# MESSENGER_CONFIG_SECTION = 'Messenger'
# REQUEST_PROCESSOR_CONFIG_SECTION = 'RequestProcessor'
# SENDER_CONFIG_SECTION = 'Sender'
# REQUEST_HANDLER_SECTION = 'RequestHandler'
# def init(configuration_file):


import json
import sys
from pushkin.sender.nordifier import constants
from pushkin.sender import senders
from pushkin import context
from pushkin import config
'''
The MIT License (MIT)
Copyright (c) 2016 Nordeus LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
'''



class NotificationSenderManager():

    def __init__(self):
        self.sender_by_name = {}
        self.sender_name_by_platform = {}


# Path: pushkin/sender/nordifier/constants.py
# SN_GUEST = 0
# SN_FACEBOOK = 1
# SN_GOOGLE = 2
# PLATFORM_ANDROID = 1
# PLATFORM_IPHONE = 2
# PLATFORM_IPAD = 5
# PLATFORM_ANDROID_TABLET = 6
# PLATFORM_BY_PROVIDER = {
#     PLATFORM_ANDROID: 1,
#     PLATFORM_ANDROID_TABLET: 1,
#     PLATFORM_IPHONE: 2,
#     PLATFORM_IPAD: 2,
# }
# NOTIFICATION_CONTROL_GROUP = -2
# NOTIFICATION_READY = -1
# NOTIFICATION_SUCCESS = 0
# NOTIFICATION_UNKNOWN_ERROR = 1
# NOTIFICATION_CONNECTION_ERROR = 2
# NOTIFICATION_EXPIRED = 3
# NOTIFICATION_UNKNOWN_PLATFORM = 4
# NOTIFICATION_SENDER_QUEUE_LIMIT = 5
# NOTIFICATION_GCM_FATAL_ERROR = 100
# NOTIFICATION_GCM_UNAVAILABLE = 101
# NOTIFICATION_GCM_INVALID_REGISTRATION_ID = 102
# NOTIFICATION_GCM_DEVICE_UNREGISTERED = 103
# NOTIFICATION_APNS_MALFORMED_ERROR = 200
# NOTIFICATION_APNS_DEVICE_UNREGISTERED = 201
# TIME_TO_LIVE_HOURS = 6
# 
# Path: pushkin/sender/senders.py
# class NotificationSender(ProcessPool):
# class NotificationOperation():
# class NotificationPostProcessor(Thread):
# class NotificationStatistics:
# class ApnNotificationSender(NotificationSender):
# class GcmNotificationSender(NotificationSender):
#     NUM_WORKERS_DEFAULT = 50
#     UPDATE_CANONICALS = 1
#     UPDATE_UNREGISTERED_DEVICES = 2
#     OPERATION_QUEUE = multiprocessing.Queue()
#     PLATFORMS = (constants.PLATFORM_IPHONE,
#                  constants.PLATFORM_IPAD)
#     PLATFORMS = (constants.PLATFORM_ANDROID,
#                  constants.PLATFORM_ANDROID_TABLET)
#     def __init__(self, **kwargs):
#     def limit_exceeded(self, notification):
#     def queue_size(self):
#     def log_notifications(self, notifications):
#     def __init__(self, operation, data):
#     def __init__(self):
#     def queue_size(self):
#     def update_canonicals(self, canonical_ids):
#     def update_unregistered_devices(self, unregistered_devices):
#     def run(self):
#     def __init__(self, name, logger, last_averages=100, log_time_seconds=30):
#     def start(self):
#     def stop(self):
#     def process(self):
#     def process(self):
# 
# Path: pushkin/context.py
# PERSIST_LOGGER_PREFFIX = 'persist_'
# def setup_loggers():
# def setup_configuration(configuration_filename):
# def start_processors():
# 
# Path: pushkin/config.py
# DATABASE_CONFIG_SECTION = 'Database'
# SERVER_SPECIFIC_CONFIG_SECTION = 'ServerSpecific'
# EVENT_CONFIG_SECTION = 'Event'
# LOG_CONFIG_SECTION = 'Log'
# SERVER_CONFIG_SECTION = 'Server'
# MESSENGER_CONFIG_SECTION = 'Messenger'
# REQUEST_PROCESSOR_CONFIG_SECTION = 'RequestProcessor'
# SENDER_CONFIG_SECTION = 'Sender'
# REQUEST_HANDLER_SECTION = 'RequestHandler'
# def init(configuration_file):


# Path: pushkin/sender/sender_manager.py
import json
import sys
from pushkin.sender.nordifier import constants
from pushkin.sender import senders
from pushkin import context
from pushkin import config

'''
The MIT License (MIT)
Copyright (c) 2016 Nordeus LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
'''



class NotificationSenderManager():

    def __init__(self):
        self.sender_by_name = {}
        self.sender_name_by_platform = {}


        values = [v.strip() for v in config.enabled_senders.split('\n')]