#
# This file was generated from the asynchronous client at conftest.py by generate_synchronous_client.sh
# Do not edit this file directly, instead edit the original file and regenerate this file.
#



import pytest

from nrp_cmd.sync_client.invenio import SyncInvenioRepositoryClient
from nrp_cmd.types.records import Record


@pytest.fixture()
def local_client(local_repository_config) -> SyncInvenioRepositoryClient:
    ret = SyncInvenioRepositoryClient.from_configuration(local_repository_config)
    return ret

@pytest.fixture()
def zenodo_client(zenodo_repository_config) -> SyncInvenioRepositoryClient:
    ret = SyncInvenioRepositoryClient.from_configuration(zenodo_repository_config)
    return ret


@pytest.fixture(scope="function")
def draft_record(request, local_client: SyncInvenioRepositoryClient) -> Record:
    records_client = local_client.records
    return records_client.create(
        {
            "title": f"async draft record for {request.node.name}",
        },
        community="acom",
        files_enabled=False,
    )


@pytest.fixture(scope="function")
def draft_record_with_files(request, local_client) -> Record:
    records_client = local_client.records
    return records_client.create(
        {
            "title": f"async draft record for {request.node.name}",
        },
        community="acom",
        files_enabled=True,
    )

@pytest.fixture(scope="function", autouse=True)
def reset_limiter() -> None:
    from nrp_cmd.sync_client.connection.limiter import current_limiter

    current_limiter.reset()

