# Path: api/theatrics/handlers/helpers.py
# @with_params(ItemParams)
# async def get_item(request, type_, id_, relations={},
#                    fields=(), expand=()):
#     item = await fetch_item(type_, id_, fields)
#     if item is None:
#         raise web.HTTPNotFound()
#     expanding_relations = project(relations, expand)
#     return await expand_item(item, expanding_relations)
# 
# @with_params(ListParams)
# async def get_list(request, query, type_=None, relations={},
#                    page=1, page_size=20, fields=(), expand=()):
#     items, count, took = await search(query, type_, page, page_size, fields)
# 
#     expanding_relations = project(relations, expand)
#     items = await expand_multiple_items(items, expanding_relations)
# 
#     previous = get_previous_page_uri(request, page, page_size)
#     next_ = get_next_page_uri(request, page, page_size, count)
# 
#     return {
#         'count': count,
#         'items': items,
#         'took': took,
#         'previous': previous,
#         'next': next_,
#     }


from datetime import datetime
from marshmallow import Schema, fields
from theatrics.scoring import get_default_score_functions
from theatrics.utils.handlers import with_params, json_response
from ..helpers import get_item, get_list





__all__ = ['event', 'event_list']


EXPANDABLE_RELATIONS = {
    'place': ('place', (
        'location', 'name', 'full_name', 'tagline', 'kind', 'is_for_kids',
        'is_stub', 'url', 'address', 'subway', 'coords', 'working_hours',
        'phone_numbers', 'age_restriction',
    )),

# Path: api/theatrics/handlers/helpers.py
# @with_params(ItemParams)
# async def get_item(request, type_, id_, relations={},
#                    fields=(), expand=()):
#     item = await fetch_item(type_, id_, fields)
#     if item is None:
#         raise web.HTTPNotFound()
#     expanding_relations = project(relations, expand)
#     return await expand_item(item, expanding_relations)
# 
# @with_params(ListParams)
# async def get_list(request, query, type_=None, relations={},
#                    page=1, page_size=20, fields=(), expand=()):
#     items, count, took = await search(query, type_, page, page_size, fields)
# 
#     expanding_relations = project(relations, expand)
#     items = await expand_multiple_items(items, expanding_relations)
# 
#     previous = get_previous_page_uri(request, page, page_size)
#     next_ = get_next_page_uri(request, page, page_size, count)
# 
#     return {
#         'count': count,
#         'items': items,
#         'took': took,
#         'previous': previous,
#         'next': next_,
#     }


# Path: api/theatrics/handlers/v1/events.py
from datetime import datetime
from marshmallow import Schema, fields
from theatrics.scoring import get_default_score_functions
from theatrics.utils.handlers import with_params, json_response
from ..helpers import get_item, get_list






__all__ = ['event', 'event_list']


EXPANDABLE_RELATIONS = {
    'place': ('place', (
        'location', 'name', 'full_name', 'tagline', 'kind', 'is_for_kids',
        'is_stub', 'url', 'address', 'subway', 'coords', 'working_hours',
        'phone_numbers', 'age_restriction',
    )),

    'parent': ('event', (