from flask_restful import Api

from PDMI.blueprints.api.download import ApiIndex, ApiModuleList, ApiModuleVersions, ApiModuleGet

# Current version
api = Api(prefix="/api/current")

api.add_resource(ApiIndex, '/',
                 endpoint='api.download.index')
api.add_resource(ApiModuleList, "/modules/",
                 endpoint="api.download.modules.list")
api.add_resource(ApiModuleVersions, "/modules/<string:module>/",
                 endpoint="api.download.modules.versions")
api.add_resource(ApiModuleGet, "/modules/<string:module>/<string:version>/",
                 endpoint="api.download.modules.get")

# Version 0.0.1

api_0_0_1 = Api(prefix="/api/v/0.0.1")

api_0_0_1.add_resource(ApiIndex, '/',
                       endpoint='api.0_0_1.download.index')
api_0_0_1.add_resource(ApiModuleList, "/modules/",
                       endpoint="api.0_0_1.download.modules.list")
api_0_0_1.add_resource(ApiModuleVersions, "/modules/<string:module>/",
                       endpoint="api.0_0_1.download.modules.versions")
api_0_0_1.add_resource(ApiModuleGet, "/modules/<string:module>/<string:version>/",
                       endpoint="api.0_0_1.download.modules.get")
