# Path: instance/models.py
# class WriteitInstancePopitInstanceRecord(models.Model):
#     STATUS_CHOICES = (
#         ("nothing", _("Not doing anything now")),
#         ("error", _("Error")),
#         ("success", _("Success")),
#         ("waiting", _("Waiting")),
#         ("inprogress", _("In Progress")),
#         )
#     writeitinstance = models.ForeignKey(WriteItInstance)
#     popitapiinstance = models.ForeignKey(ApiInstance)
#     periodicity = models.CharField(
#         max_length="2",
#         choices=PERIODICITY,
#         default='1W',
#         )
#     status = models.CharField(
#         max_length="20",
#         choices=STATUS_CHOICES,
#         default="nothing",
#         )
#     status_explanation = models.TextField(default='')
#     updated = models.DateTimeField(auto_now_add=True)
#     created = models.DateTimeField(auto_now_add=True, editable=False)
# 
#     def __unicode__(self):
#         return "The people from {url} were loaded into {instance}".format(
#             url=self.popitapiinstance.url,
#             instance=self.writeitinstance.__unicode__(),
#             )
# 
#     def set_status(self, status, explanation=''):
#         self.status = status
#         self.status_explanation = explanation
#         self.save()
# 
# Path: nuntium/popit_api_instance.py
# class PopitApiInstance(ApiInstance):
#     class Meta:
#         proxy = True
# 
#     def fetch_all_from_api(self, writeitinstance):
#         """
#         Update all the local data from the API. This method actually delegates
#         to the other models.
#         """
#         models = [PopitPerson]
#         for model in models:
#             model.fetch_all_from_api(instance=self, writeitinstance=writeitinstance)


from celery import task
from .management.commands.send_mails import send_mails
from instance.models import WriteitInstancePopitInstanceRecord
from nuntium.popit_api_instance import PopitApiInstance
import logging


logger = logging.getLogger(__name__)


@task()
def send_mails_task():

# Path: instance/models.py
# class WriteitInstancePopitInstanceRecord(models.Model):
#     STATUS_CHOICES = (
#         ("nothing", _("Not doing anything now")),
#         ("error", _("Error")),
#         ("success", _("Success")),
#         ("waiting", _("Waiting")),
#         ("inprogress", _("In Progress")),
#         )
#     writeitinstance = models.ForeignKey(WriteItInstance)
#     popitapiinstance = models.ForeignKey(ApiInstance)
#     periodicity = models.CharField(
#         max_length="2",
#         choices=PERIODICITY,
#         default='1W',
#         )
#     status = models.CharField(
#         max_length="20",
#         choices=STATUS_CHOICES,
#         default="nothing",
#         )
#     status_explanation = models.TextField(default='')
#     updated = models.DateTimeField(auto_now_add=True)
#     created = models.DateTimeField(auto_now_add=True, editable=False)
# 
#     def __unicode__(self):
#         return "The people from {url} were loaded into {instance}".format(
#             url=self.popitapiinstance.url,
#             instance=self.writeitinstance.__unicode__(),
#             )
# 
#     def set_status(self, status, explanation=''):
#         self.status = status
#         self.status_explanation = explanation
#         self.save()
# 
# Path: nuntium/popit_api_instance.py
# class PopitApiInstance(ApiInstance):
#     class Meta:
#         proxy = True
# 
#     def fetch_all_from_api(self, writeitinstance):
#         """
#         Update all the local data from the API. This method actually delegates
#         to the other models.
#         """
#         models = [PopitPerson]
#         for model in models:
#             model.fetch_all_from_api(instance=self, writeitinstance=writeitinstance)


# Path: nuntium/tasks.py
from celery import task
from .management.commands.send_mails import send_mails
from instance.models import WriteitInstancePopitInstanceRecord
from nuntium.popit_api_instance import PopitApiInstance
import logging



logger = logging.getLogger(__name__)


@task()
def send_mails_task():

    send_mails()