# -*- coding: utf-8 -*-

from flask import Blueprint
from flask_restful import Api
{%- for item in config %}
from . import {{item["name"]}}
{%- endfor %}

api_v1 = Blueprint('api_v1', __name__)

api = Api(api_v1)

{% for item in config %}
api.add_resource({{ item['name'] }}.{{ item['name'] | letterUpper }}Resource, '/{{ item['name'] }}{{ item['view']['get']['path'] }}'{% if item['view']['get']['endpoint'] %}, endpoint={{ item['view']['get']['endpoint'] }}{% endif %})
api.add_resource({{ item['name'] }}.{{ item['name'] | letterUpper }}ResourceList, '/{{ item['name'] }}{{ item['view']['getList']['path'] }}'{% if item['view']['getList']['endpoint'] %}, endpoint='{{ item['view']['getList']['endpoint'] }}'{% endif %})
{% endfor %}
