# Copyright (c) 2017 iXsystems, Inc.
# All rights reserved.
# This file is a part of TrueNAS
# and may not be copied and/or distributed
# without the express permission of iXsystems.

from django.utils.translation import ugettext as _

from freenasUI.system.alert import alertPlugins, Alert, BaseAlert
from freenasUI.system.models import Advanced


class IxAlert(BaseAlert):

    def run(self):
        adv = Advanced.objects.order_by('-id')[0]
        if adv.adv_ixalert and not adv.adv_ixfailsafe_email:
            return [Alert(
                Alert.WARN,
                _('Failsafe Support Contact field should be filled in System -> Advanced tab.')
            )]


alertPlugins.register(IxAlert)
