# Path: bidwire/notifiers/base_notifier.py
# class BaseNotifier:
#     def __init__(self):
#         self.site_name = self.get_site().value
# 
#     # TODO(anaulin): Remove this method, and replace it with setting the
#     # site_name in each constructor.
#     def get_site(self):
#         """Identifies the site type of the notifier
# 
#         Returns:
#         site -- object of type Bid.Site
#         """
#         raise NotImplementedError
# 
#     def get_listings_pre_text(self, items_length):
#         """Heading text before listings are displayed
# 
#         Arguments:
#         bids_length -- number of new bids in the email
# 
#         Returns:
#         text -- string of text preceding the listings
#         """
#         raise NotImplementedError
# 
#     def make_item_body(self, item):
#         """Returns the HTML-formatted item for the new item list, as string."""
#         raise NotImplementedError
# 
#     def send_new_items_notification(self, bids, recipients):
#         log.info("Sending notifications to {} about bids {}"
#                  .format(recipients, bids))
#         subject = "Changes detected on {}".format(self.site_name)
#         send_email(subject, self.make_email_body(bids), recipients)
# 
#     def make_email_body(self, items):
#         return make_html_body(
#             items,
#             self.make_item_body,
#             pre_list_text=self.get_listings_pre_text(len(items))
#         )
# 
# Path: bidwire/notifiers/notifier_utils.py
# def make_doc_item_body(document):
#     """Returns the HTML for one Document item"""
#     doc, tag, text = Doc().tagtext()
#     with tag('strong'):
#         with tag('a', href=document.url):
#             text(document.title)
#     return doc.getvalue()


from .base_notifier import BaseNotifier
from .notifier_utils import make_doc_item_body
from document import Document


class MassGovNotifier(BaseNotifier):
    def get_site(self):
        return Document.Site.MASSGOV_EOPSS

    def get_listings_pre_text(self, items_length):
        formatted_text = "{} new Funding and Training documents" \
            .format(items_length)
        return "We have found " + formatted_text + " since we last sent " + \
            " you an update: "

    def make_item_body(self, doc):

# Path: bidwire/notifiers/base_notifier.py
# class BaseNotifier:
#     def __init__(self):
#         self.site_name = self.get_site().value
# 
#     # TODO(anaulin): Remove this method, and replace it with setting the
#     # site_name in each constructor.
#     def get_site(self):
#         """Identifies the site type of the notifier
# 
#         Returns:
#         site -- object of type Bid.Site
#         """
#         raise NotImplementedError
# 
#     def get_listings_pre_text(self, items_length):
#         """Heading text before listings are displayed
# 
#         Arguments:
#         bids_length -- number of new bids in the email
# 
#         Returns:
#         text -- string of text preceding the listings
#         """
#         raise NotImplementedError
# 
#     def make_item_body(self, item):
#         """Returns the HTML-formatted item for the new item list, as string."""
#         raise NotImplementedError
# 
#     def send_new_items_notification(self, bids, recipients):
#         log.info("Sending notifications to {} about bids {}"
#                  .format(recipients, bids))
#         subject = "Changes detected on {}".format(self.site_name)
#         send_email(subject, self.make_email_body(bids), recipients)
# 
#     def make_email_body(self, items):
#         return make_html_body(
#             items,
#             self.make_item_body,
#             pre_list_text=self.get_listings_pre_text(len(items))
#         )
# 
# Path: bidwire/notifiers/notifier_utils.py
# def make_doc_item_body(document):
#     """Returns the HTML for one Document item"""
#     doc, tag, text = Doc().tagtext()
#     with tag('strong'):
#         with tag('a', href=document.url):
#             text(document.title)
#     return doc.getvalue()


# Path: bidwire/notifiers/massgov_notifier.py
from .base_notifier import BaseNotifier
from .notifier_utils import make_doc_item_body
from document import Document



class MassGovNotifier(BaseNotifier):
    def get_site(self):
        return Document.Site.MASSGOV_EOPSS

    def get_listings_pre_text(self, items_length):
        formatted_text = "{} new Funding and Training documents" \
            .format(items_length)
        return "We have found " + formatted_text + " since we last sent " + \
            " you an update: "

    def make_item_body(self, doc):

        return make_doc_item_body(doc)