# Path: glottolog3/interfaces.py
# class IProvider(Interface):
#     """marker
#     """
# 
# Path: glottolog3/config.py
# def github(path):
#     """
#     :param path: relative (to the root) path of a file in the glottolog data repository
#     :return: URL to a file in Glottolog's data repository on GitHub
#     """
#     return 'https://github.com/glottolog/glottolog/blob/master/{0}'.format(path)


from string import capwords
from zope.interface import implementer
from sqlalchemy import (
    Column,
    String,
    Boolean,
    Unicode,
    Integer,
    ForeignKey,
    desc,
    UniqueConstraint,
    and_,
    cast,
    Text,
    Index,
)
from sqlalchemy.orm import relationship, backref, joinedload
from sqlalchemy.dialects.postgresql import TSVECTOR
from sqlalchemy.sql.expression import func
from clld.interfaces import ISource, ILanguage
from clld.db.meta import DBSession, Base, CustomModelMixin
from clld.db.models.common import (
    Language, Source, IdNameDescriptionMixin, IdentifierType, Identifier, Parameter,
)
from clld.util import DeclEnum
from glottolog3.interfaces import IProvider
from glottolog3.config import github
"""
Project related model.
"""






def get_parameter(pid):
    return DBSession.query(Parameter)\
        .filter(Parameter.id == pid)\
        .options(joinedload(Parameter.domain))\
        .one()


def get_source(key):
    return DBSession.query(Ref).join(Refprovider).filter(Refprovider.id == key).one()



# Path: glottolog3/interfaces.py
# class IProvider(Interface):
#     """marker
#     """
# 
# Path: glottolog3/config.py
# def github(path):
#     """
#     :param path: relative (to the root) path of a file in the glottolog data repository
#     :return: URL to a file in Glottolog's data repository on GitHub
#     """
#     return 'https://github.com/glottolog/glottolog/blob/master/{0}'.format(path)


# Path: glottolog3/models.py
from string import capwords
from zope.interface import implementer
from sqlalchemy import (
    Column,
    String,
    Boolean,
    Unicode,
    Integer,
    ForeignKey,
    desc,
    UniqueConstraint,
    and_,
    cast,
    Text,
    Index,
)
from sqlalchemy.orm import relationship, backref, joinedload
from sqlalchemy.dialects.postgresql import TSVECTOR
from sqlalchemy.sql.expression import func
from clld.interfaces import ISource, ILanguage
from clld.db.meta import DBSession, Base, CustomModelMixin
from clld.db.models.common import (
    Language, Source, IdNameDescriptionMixin, IdentifierType, Identifier, Parameter,
)
from clld.util import DeclEnum
from glottolog3.interfaces import IProvider
from glottolog3.config import github

"""
Project related model.
"""






def get_parameter(pid):
    return DBSession.query(Parameter)\
        .filter(Parameter.id == pid)\
        .options(joinedload(Parameter.domain))\
        .one()


def get_source(key):
    return DBSession.query(Ref).join(Refprovider).filter(Refprovider.id == key).one()



@implementer(IProvider)