# Path: dashboard/models/alert.py
# class Feedback(object):
# class Alert(object):
# class Rules(object):
# class FakeAlert(object):
#     def __init__(self, alert_dict, alert_action):
#     def connect_sns(self):
#     def connect_ssm(self):
#     def get_sns_arn(self):
#     def _construct_alert(self):
#     def send(self):
#     def __init__(self):
#     def has_actions(self, alert_dict):
#     def has_escalation(self, alert_dict):
#     def connect_dynamodb(self):
#     def find_or_create_by(self, alert_dict, user_id):
#     def create(self, alert_dict):
#     def destroy(self, alert_id, user_id):
#     def update(self, alert_id, alert_dict):
#     def find(self, user_id):
#     def _alert_is_expired(self, alert):
#     def to_summary(self, alert_dict):
#     def find_by_id(self, alert_id):
#     def _create_alert_id(self):
#     def __init__(self, userinfo, request):
#     def run(self):
#     def alert_firefox_out_of_date(self):
#     def _firefox_info(self):
#     def _user_firefox_version(self):
#     def _version_to_dictionary(self, version_number):
#     def _firefox_out_of_date(self):
#     def __init__(self, user_id):
#     def create_fake_alerts(self):
#     def _create_fake_browser_alert(self):
#     def _create_fake_geolocation_alert(self):


import logging
import time
from faker import Faker
from dashboard.models import alert
        alerts = alert.Alert().find(user_id=self.userinfo["sub"])
        return alerts

    def take_alert_action(self, alert_id, alert_action, helpfulness=None):
        a = alert.Alert()
        alert_dict = a.find_by_id(alert_id)

        alert_dict["last_update"] = int(time.time())

        if alert_action == "acknowledge":
            logger.info(
                "An alert was acked for {uid}.".format(uid=self.userinfo["sub"])
            )
            alert_dict["state"] = alert_action
            res = a.update(alert_id=alert_id, alert_dict=alert_dict)
        elif alert_action == "escalate":
            logger.info(
                "An alert was escalated for {uid}.".format(uid=self.userinfo["sub"])
            )
            alert_dict["state"] = alert_action
            res = a.update(alert_id=alert_id, alert_dict=alert_dict)
        elif alert_action == "indicate-helpfulness":
            logger.info(
                "Alert helpfulness was set for {uid}.".format(uid=self.userinfo["sub"])
            )
            alert_dict["helpfulness"] = helpfulness
            res = a.update(alert_id=alert_id, alert_dict=alert_dict)
        else:
            res = {"ResponseMetadata": {"HTTPStatusCode": 200}}


# Path: dashboard/models/alert.py
# class Feedback(object):
# class Alert(object):
# class Rules(object):
# class FakeAlert(object):
#     def __init__(self, alert_dict, alert_action):
#     def connect_sns(self):
#     def connect_ssm(self):
#     def get_sns_arn(self):
#     def _construct_alert(self):
#     def send(self):
#     def __init__(self):
#     def has_actions(self, alert_dict):
#     def has_escalation(self, alert_dict):
#     def connect_dynamodb(self):
#     def find_or_create_by(self, alert_dict, user_id):
#     def create(self, alert_dict):
#     def destroy(self, alert_id, user_id):
#     def update(self, alert_id, alert_dict):
#     def find(self, user_id):
#     def _alert_is_expired(self, alert):
#     def to_summary(self, alert_dict):
#     def find_by_id(self, alert_id):
#     def _create_alert_id(self):
#     def __init__(self, userinfo, request):
#     def run(self):
#     def alert_firefox_out_of_date(self):
#     def _firefox_info(self):
#     def _user_firefox_version(self):
#     def _version_to_dictionary(self, version_number):
#     def _firefox_out_of_date(self):
#     def __init__(self, user_id):
#     def create_fake_alerts(self):
#     def _create_fake_browser_alert(self):
#     def _create_fake_geolocation_alert(self):


# Path: dashboard/models/user.py
import logging
import time
from faker import Faker
from dashboard.models import alert

        alerts = alert.Alert().find(user_id=self.userinfo["sub"])
        return alerts

    def take_alert_action(self, alert_id, alert_action, helpfulness=None):
        a = alert.Alert()
        alert_dict = a.find_by_id(alert_id)

        alert_dict["last_update"] = int(time.time())

        if alert_action == "acknowledge":
            logger.info(
                "An alert was acked for {uid}.".format(uid=self.userinfo["sub"])
            )
            alert_dict["state"] = alert_action
            res = a.update(alert_id=alert_id, alert_dict=alert_dict)
        elif alert_action == "escalate":
            logger.info(
                "An alert was escalated for {uid}.".format(uid=self.userinfo["sub"])
            )
            alert_dict["state"] = alert_action
            res = a.update(alert_id=alert_id, alert_dict=alert_dict)
        elif alert_action == "indicate-helpfulness":
            logger.info(
                "Alert helpfulness was set for {uid}.".format(uid=self.userinfo["sub"])
            )
            alert_dict["helpfulness"] = helpfulness
            res = a.update(alert_id=alert_id, alert_dict=alert_dict)
        else:
            res = {"ResponseMetadata": {"HTTPStatusCode": 200}}


        m = alert.Feedback(alert_dict=alert_dict, alert_action=alert_action)