"""ToyBox API Server in Python 3.7."""


__author__ = 'Pavel Simakov (psimakov@google.com)'


import datetime
import json
import logging
import mimetypes
import os
import traceback
import auth
import flask
from werkzeug.exceptions import HTTPException
import dao

# configure logging
logging.basicConfig()
logging.getLogger().setLevel(logging.INFO)

# here we define user roles; roles are additive bundles of priveleges
ROLE_USER = 'user'              # id_token verified; whitelist rules passed
ROLE_MODERATOR = 'moderator'    # valid user, who has moderator priveleges
ROLE_ADMIN = 'admin'            # valid user, who has admin priveleges
ROLES_ALL = [ROLE_USER, ROLE_MODERATOR, ROLE_ADMIN]

# profile visibility
PROFILE_VISIBILITY_PRIVATE = 'private'
PROFILE_VISIBILITY_PUBLIC = 'public'
PROFILE_VISIBILITY = {
    PROFILE_VISIBILITY_PRIVATE: 'private (hidden from other site users)',
    PROFILE_VISIBILITY_PUBLIC: 'public (visible to other site users)',
}

# tags that user can assign to their profile
PROFILE_TAGS = {
    '1': 'sports',
    '2': 'dance',
    '3': 'science',
    '4': 'reading',
    '5': 'politics',