import logging
import os

import pytest
from dotenv import load_dotenv

from verse_sdk import verse
from verse_sdk.exporters.file import FileConfig

load_dotenv()


verse.init(
    app_name="verse_e2e_suite",
    environment="development",
    exporters=[
        verse.exporters.file(FileConfig(folder_path=".files")),
        verse.exporters.console(),
        # Note:
        # Add more exporters to test remote origins (e.g. Langfuse, OTLP, etc.)
        # On an as-needed basis without committing them to the repo
    ],
    vendors=[
        "anthropic",
        "google",
        "langchain",
        "litellm",
        "pydantic_ai",
    ],
    version="1.0.0",
)


@pytest.fixture(scope="session", autouse=True)
def cleanup_files():
    yield

    try:
        for file in os.listdir(".files/"):
            os.remove(f".files/{file}")
    except Exception as e:
        logging.error(f"Error cleaning up files: {e}")
