# Path: girder/app/app/constants.py
# class Features:
#     NOTEBOOKS = 'app.features.notebooks'
# 
# class Deployment:
#     SITE = 'app.deployment.site'
# 
# class Branding:
#     PRIVACY = 'app.configuration.privacy'
#     LICENSE = 'app.configuration.license'
#     HEADER_LOGO_ID = 'app.configuration.header.logo.file.id'
#     FOOTER_LOGO_ID = 'app.configuration.footer.logo.file.id'
#     FOOTER_LOGO_URL = 'app.configuration.footer.logo.url',
#     FAVICON_ID = 'app.configuration.favicon.file.id'


from girder.api import access
from girder.api.describe import Description, autoDescribeRoute
from girder.api.rest import Resource, RestException
from girder.constants import AccessType, TokenScope
from girder.models.setting import Setting
from .constants import Features, Deployment, Branding

class Configuration(Resource):

    def __init__(self):
        super(Configuration, self).__init__()
        self.resourceName = 'configuration'
        self.route('GET', (), self.get)

    @access.public
    @autoDescribeRoute(
        Description('Get the deployment configuration.')
    )
    def get(self):

        notebooks = Setting().get(Features.NOTEBOOKS)
        if notebooks is None:
            notebooks = True

        site = Setting().get(Deployment.SITE)
        if site is None:
            site = ''

        return {
            'features': {
                'notebooks': notebooks
            },
            'deployment': {
                'site': site
            },
            'branding': {

# Path: girder/app/app/constants.py
# class Features:
#     NOTEBOOKS = 'app.features.notebooks'
# 
# class Deployment:
#     SITE = 'app.deployment.site'
# 
# class Branding:
#     PRIVACY = 'app.configuration.privacy'
#     LICENSE = 'app.configuration.license'
#     HEADER_LOGO_ID = 'app.configuration.header.logo.file.id'
#     FOOTER_LOGO_ID = 'app.configuration.footer.logo.file.id'
#     FOOTER_LOGO_URL = 'app.configuration.footer.logo.url',
#     FAVICON_ID = 'app.configuration.favicon.file.id'


# Path: girder/app/app/configuration.py
from girder.api import access
from girder.api.describe import Description, autoDescribeRoute
from girder.api.rest import Resource, RestException
from girder.constants import AccessType, TokenScope
from girder.models.setting import Setting
from .constants import Features, Deployment, Branding


class Configuration(Resource):

    def __init__(self):
        super(Configuration, self).__init__()
        self.resourceName = 'configuration'
        self.route('GET', (), self.get)

    @access.public
    @autoDescribeRoute(
        Description('Get the deployment configuration.')
    )
    def get(self):

        notebooks = Setting().get(Features.NOTEBOOKS)
        if notebooks is None:
            notebooks = True

        site = Setting().get(Deployment.SITE)
        if site is None:
            site = ''

        return {
            'features': {
                'notebooks': notebooks
            },
            'deployment': {
                'site': site
            },
            'branding': {

                'license': Setting().get(Branding.LICENSE),