# Path: errors.py
# class InvalidToggleName(Exception):
#     pass
# 
# Path: errors.py
# class InvalidToggleState(Exception):
#     pass
# 
# Path: models/toggle.py
# class Toggle(ndb.Model):
#     name = ndb.StringProperty()
#     state = ndb.BooleanProperty()
# 
# Path: models/toggle.py
# TOGGLE_NAMES = set([
#     LOVE_SENDING_ENABLED
# ])
# 
# Path: models/toggle.py
# TOGGLE_STATES = set([True, False])


from time import sleep
from errors import InvalidToggleName
from errors import InvalidToggleState
from models import Toggle
from models.toggle import TOGGLE_NAMES
from models.toggle import TOGGLE_STATES
# -*- coding: utf-8 -*-



def _validate_and_maybe_create_toggle(name, state):
    if name not in TOGGLE_NAMES:
        raise InvalidToggleName(name)
    if state not in TOGGLE_STATES:
        raise InvalidToggleState(str(state))


# Path: errors.py
# class InvalidToggleName(Exception):
#     pass
# 
# Path: errors.py
# class InvalidToggleState(Exception):
#     pass
# 
# Path: models/toggle.py
# class Toggle(ndb.Model):
#     name = ndb.StringProperty()
#     state = ndb.BooleanProperty()
# 
# Path: models/toggle.py
# TOGGLE_NAMES = set([
#     LOVE_SENDING_ENABLED
# ])
# 
# Path: models/toggle.py
# TOGGLE_STATES = set([True, False])


# Path: logic/toggle.py
from time import sleep
from errors import InvalidToggleName
from errors import InvalidToggleState
from models import Toggle
from models.toggle import TOGGLE_NAMES
from models.toggle import TOGGLE_STATES

# -*- coding: utf-8 -*-



def _validate_and_maybe_create_toggle(name, state):
    if name not in TOGGLE_NAMES:
        raise InvalidToggleName(name)
    if state not in TOGGLE_STATES:
        raise InvalidToggleState(str(state))


    toggle = Toggle.query(Toggle.name == name).get()