# 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 Heroku(Service):
    name = 'Heroku'
    status_url = 'https://status.heroku.com/'
    icon_url = '/images/icons/heroku.png'

    def get_status(self):
        r = requests.get('https://status.heroku.com/api/v3/current-status')
        res = r.json()
        status = res['status']['Production']

        if status == 'green':
            return Status.ok
        elif status == 'yellow':
            return Status.minor
        elif status == 'orange':

# 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/heroku.py
import requests
from isserviceup.services.models.service import Service, Status




class Heroku(Service):
    name = 'Heroku'
    status_url = 'https://status.heroku.com/'
    icon_url = '/images/icons/heroku.png'

    def get_status(self):
        r = requests.get('https://status.heroku.com/api/v3/current-status')
        res = r.json()
        status = res['status']['Production']

        if status == 'green':
            return Status.ok
        elif status == 'yellow':
            return Status.minor
        elif status == 'orange':

            return Status.major