# Path: isserviceup/services/models/service.py
# class Service(object):
# 
#     @property
#     def id(self):
#         return self.__class__.__name__
# 
#     @property
#     def status_url(self):
#         raise NotImplemented()
# 
#     @property
#     def icon_url(self):
#         raise NotImplemented()
# 
#     @property
#     def name(self):
#         raise NotImplemented()
# 
#     def get_status(self):
#         raise NotImplemented()
# 
# class Status(Enum):
#     ok = 1              # green
#     maintenance = 2     # blue
#     minor = 3           # yellow
#     major = 4           # orange
#     critical = 5        # red
#     unavailable = 6     # gray


import requests
from isserviceup.services.models.service import Service, Status



class StatusIOPlugin(Service):

    status_url = 'https://api.status.io/'

    @property
    def statuspage_id(self):
        raise NotImplemented()

    def get_status(self):
        r = requests.get('{}/1.0/status/{}'.format(
            self.status_url.strip("/"), self.statuspage_id
        ))
        try:
            j = r.json()
        except ValueError:
            print(r.content)
            raise
        expected_status = {
            100: Status.ok,
            200: Status.minor,
            300: Status.major,
            400: Status.critical,
            500: Status.critical,

# Path: isserviceup/services/models/service.py
# class Service(object):
# 
#     @property
#     def id(self):
#         return self.__class__.__name__
# 
#     @property
#     def status_url(self):
#         raise NotImplemented()
# 
#     @property
#     def icon_url(self):
#         raise NotImplemented()
# 
#     @property
#     def name(self):
#         raise NotImplemented()
# 
#     def get_status(self):
#         raise NotImplemented()
# 
# class Status(Enum):
#     ok = 1              # green
#     maintenance = 2     # blue
#     minor = 3           # yellow
#     major = 4           # orange
#     critical = 5        # red
#     unavailable = 6     # gray


# Path: isserviceup/services/models/statusio.py
import requests
from isserviceup.services.models.service import Service, Status




class StatusIOPlugin(Service):

    status_url = 'https://api.status.io/'

    @property
    def statuspage_id(self):
        raise NotImplemented()

    def get_status(self):
        r = requests.get('{}/1.0/status/{}'.format(
            self.status_url.strip("/"), self.statuspage_id
        ))
        try:
            j = r.json()
        except ValueError:
            print(r.content)
            raise
        expected_status = {
            100: Status.ok,
            200: Status.minor,
            300: Status.major,
            400: Status.critical,
            500: Status.critical,

            600: Status.maintenance,