def get_event(event_id):

    manager = CalendarSynchronizer()
    event = manager.get_event(event_id)
    if event is None:
        return Response('Not Found Event', status=404)
    
    response_body = event.serialize(request.accept_mimetypes)
    return Response(response_body, status=200, mimetype=request.accept_mimetypes[0][0])
def get_event(event_id):

    manager = CalendarSynchronizer()
    event = manager.get_event(event_id)
    if event is None:
        return Response('Not Found Event', status=404)

    response_body = event.serialize(request.accept_mimetypes)
    return Response(response_body,
                    status=200,
                    mimetype=request.accept_mimetypes[0][0])
def delete_event(event_id):

    manager = CalendarSynchronizer()
    #before to remoe it, we need to collect the event to know the location, we don't want to delegate this action to the CalendarSynchronizer
    #if we didn't want to create two calls to the calendar, we will need to translate this validation to the CalendarSynchronizer
    event = manager.get_event(event_id)
    if event is None:
        return Response('Not Found Event', status=404)
    #validate the authorization to delete it
    authorization(event.location)

    status = manager.remove_event(event_id)
    if status:
        #Notify when a new event is created
        _contextbroker = ContextBrokerNotificator()
        _contextbroker.notify_event(event, _contextbroker.DELETED_EVENT)

        return Response(status=204)
    else:
        return Response('Not Found Event', status=404)
def delete_event(event_id):

    manager = CalendarSynchronizer()
    #before to remoe it, we need to collect the event to know the location, we don't want to delegate this action to the CalendarSynchronizer
    #if we didn't want to create two calls to the calendar, we will need to translate this validation to the CalendarSynchronizer
    event = manager.get_event(event_id)
    if event is None:
        return Response('Not Found Event', status=404)
    #validate the authorization to delete it
    authorization(event.location)

    status = manager.remove_event(event_id)
    if status:
        #Notify when a new event is created
        _contextbroker = ContextBrokerNotificator()
        _contextbroker.notify_event(event, _contextbroker.DELETED_EVENT)

        return Response(status=204)
    else:
        return Response('Not Found Event', status=404)