# Path: moira_client/client.py
# class ResponseStructureError(Exception):
#     def __init__(self, msg, content):
#         """
# 
#         :param msg: str error message
#         :param content: dict response content
#         """
#         self.msg = msg
#         self.content = content
# 
# Path: moira_client/client.py
# class InvalidJSONError(Exception):
#     def __init__(self, content):
#         """
# 
#         :param content: bytes response content
#         """
#         self.content = content
# 
# Path: moira_client/models/base.py
# class Base:
#     @property
#     def id(self):
#         return self._id
# 
#     def __repr__(self):
#         return '({} {})'.format(self.__class__.__name__, self.id)
# 
#     def __unicode__(self):
#         return u'({} {})'.format(self.__class__.__name__, self.id)
# 
#     def __eq__(self, other):
#         return self.id == other.id
# 
#     def __ne__(self, other):
#         return self.id != other.id
# 
# Path: moira_client/models/common.py
# MINUTES_IN_HOUR = 60
# 
# def get_schedule(start_hour, start_minute, end_hour, end_minute, disabled_days):
#     days = []
#     for day in DAYS_OF_WEEK:
#         day_info = {
#             'enabled': True if day not in disabled_days else False,
#             'name': day
#         }
#         days.append(day_info)
#     return {
#         'days': days,
#         'startOffset': start_hour * MINUTES_IN_HOUR + start_minute,
#         'endOffset': end_hour * MINUTES_IN_HOUR + end_minute,
#     }


from ..client import ResponseStructureError
from ..client import InvalidJSONError
from .base import Base
from .common import MINUTES_IN_HOUR, get_schedule
        """
        self.disabled_days.remove(day)

    @property
    def id(self):
        return self._id

    def _send_request(self, trigger_id=None):
        data = {
            'name': self.name,
            'tags': self.tags,
            'targets': self.targets,
            'warn_value': self.warn_value,
            'error_value': self.error_value,
            'desc': self.desc,
            'ttl': self.ttl,
            'ttl_state': self.ttl_state,
            'sched': self.sched,
            'expression': self.expression,
            'is_remote': self.is_remote,
            'trigger_type': self.trigger_type,
            'mute_new_metrics': self.mute_new_metrics,
            'alone_metrics': self.alone_metrics,
        }

        if trigger_id:
            data['id'] = trigger_id
            api_response = TriggerManager(
                self._client).fetch_by_id(trigger_id)


# Path: moira_client/client.py
# class ResponseStructureError(Exception):
#     def __init__(self, msg, content):
#         """
# 
#         :param msg: str error message
#         :param content: dict response content
#         """
#         self.msg = msg
#         self.content = content
# 
# Path: moira_client/client.py
# class InvalidJSONError(Exception):
#     def __init__(self, content):
#         """
# 
#         :param content: bytes response content
#         """
#         self.content = content
# 
# Path: moira_client/models/base.py
# class Base:
#     @property
#     def id(self):
#         return self._id
# 
#     def __repr__(self):
#         return '({} {})'.format(self.__class__.__name__, self.id)
# 
#     def __unicode__(self):
#         return u'({} {})'.format(self.__class__.__name__, self.id)
# 
#     def __eq__(self, other):
#         return self.id == other.id
# 
#     def __ne__(self, other):
#         return self.id != other.id
# 
# Path: moira_client/models/common.py
# MINUTES_IN_HOUR = 60
# 
# def get_schedule(start_hour, start_minute, end_hour, end_minute, disabled_days):
#     days = []
#     for day in DAYS_OF_WEEK:
#         day_info = {
#             'enabled': True if day not in disabled_days else False,
#             'name': day
#         }
#         days.append(day_info)
#     return {
#         'days': days,
#         'startOffset': start_hour * MINUTES_IN_HOUR + start_minute,
#         'endOffset': end_hour * MINUTES_IN_HOUR + end_minute,
#     }


# Path: moira_client/models/trigger.py
from ..client import ResponseStructureError
from ..client import InvalidJSONError
from .base import Base
from .common import MINUTES_IN_HOUR, get_schedule

        """
        self.disabled_days.remove(day)

    @property
    def id(self):
        return self._id

    def _send_request(self, trigger_id=None):
        data = {
            'name': self.name,
            'tags': self.tags,
            'targets': self.targets,
            'warn_value': self.warn_value,
            'error_value': self.error_value,
            'desc': self.desc,
            'ttl': self.ttl,
            'ttl_state': self.ttl_state,
            'sched': self.sched,
            'expression': self.expression,
            'is_remote': self.is_remote,
            'trigger_type': self.trigger_type,
            'mute_new_metrics': self.mute_new_metrics,
            'alone_metrics': self.alone_metrics,
        }

        if trigger_id:
            data['id'] = trigger_id
            api_response = TriggerManager(
                self._client).fetch_by_id(trigger_id)


        data['sched'] = get_schedule(self._start_hour, self._start_minute, self._end_hour, self._end_minute,