# Path: invenio_deposit/utils.py
# def mark_as_action(f):
# def extract_actions_from_class(record_class):
# def check_oauth2_scope(can_method, *myscopes):
#     def check(record, *args, **kwargs):
#         def can(self):
# def can_elasticsearch(record):


from invenio_records_rest.facets import terms_filter
from invenio_records_rest.utils import check_elasticsearch
from .utils import check_oauth2_scope_write, \
    check_oauth2_scope_write_elasticsearch

_PID = 'pid(depid,record_class="invenio_deposit.api:Deposit")'

DEPOSIT_REST_ENDPOINTS = {
    'depid': {
        'pid_type': 'depid',
        'pid_minter': 'deposit',
        'pid_fetcher': 'deposit',
        'record_class': 'invenio_deposit.api:Deposit',
        'files_serializers': {
            'application/json': ('invenio_deposit.serializers'
                                 ':json_v1_files_response'),
        },
        'record_serializers': {
            'application/json': ('invenio_records_rest.serializers'
                                 ':json_v1_response'),
        },
        'search_class': 'invenio_deposit.search:DepositSearch',
        'search_serializers': {
            'application/json': ('invenio_records_rest.serializers'
                                 ':json_v1_search'),
        },
        'list_route': '/deposits/',
        'indexer_class': None,
        'item_route': '/deposits/<{0}:pid_value>'.format(_PID),
        'file_list_route': '/deposits/<{0}:pid_value>/files'.format(_PID),
        'file_item_route':
            '/deposits/<{0}:pid_value>/files/<path:key>'.format(_PID),
        'default_media_type': 'application/json',
        'links_factory_imp': 'invenio_deposit.links:deposit_links_factory',

# Path: invenio_deposit/utils.py
# def mark_as_action(f):
# def extract_actions_from_class(record_class):
# def check_oauth2_scope(can_method, *myscopes):
#     def check(record, *args, **kwargs):
#         def can(self):
# def can_elasticsearch(record):


# Path: invenio_deposit/config.py
from invenio_records_rest.facets import terms_filter
from invenio_records_rest.utils import check_elasticsearch
from .utils import check_oauth2_scope_write, \
    check_oauth2_scope_write_elasticsearch


_PID = 'pid(depid,record_class="invenio_deposit.api:Deposit")'

DEPOSIT_REST_ENDPOINTS = {
    'depid': {
        'pid_type': 'depid',
        'pid_minter': 'deposit',
        'pid_fetcher': 'deposit',
        'record_class': 'invenio_deposit.api:Deposit',
        'files_serializers': {
            'application/json': ('invenio_deposit.serializers'
                                 ':json_v1_files_response'),
        },
        'record_serializers': {
            'application/json': ('invenio_records_rest.serializers'
                                 ':json_v1_response'),
        },
        'search_class': 'invenio_deposit.search:DepositSearch',
        'search_serializers': {
            'application/json': ('invenio_records_rest.serializers'
                                 ':json_v1_search'),
        },
        'list_route': '/deposits/',
        'indexer_class': None,
        'item_route': '/deposits/<{0}:pid_value>'.format(_PID),
        'file_list_route': '/deposits/<{0}:pid_value>/files'.format(_PID),
        'file_item_route':
            '/deposits/<{0}:pid_value>/files/<path:key>'.format(_PID),
        'default_media_type': 'application/json',
        'links_factory_imp': 'invenio_deposit.links:deposit_links_factory',

        'create_permission_factory_imp': check_oauth2_scope_write,