"""Shared test fixtures for agent_scout core tests."""

from __future__ import annotations

import pytest

from agent_scout.db.database import Database
from agent_scout.db.models import AutonomyLevel, Task, TaskStatus
from agent_scout.events import EventBus


@pytest.fixture
def sample_task():
    """A sample task description for testing."""
    return {
        "description": "Find the best flight from NYC to London on Feb 28",
        "autonomy": "full",
        "budget": 1.00,
    }


@pytest.fixture
def event_bus():
    """Fresh EventBus instance."""
    return EventBus()


@pytest.fixture
def task_obj():
    """A Task model instance."""
    return Task(
        description="Find the best laptop under $1000",
        status=TaskStatus.PENDING,
        autonomy=AutonomyLevel.FULL,
        budget_limit=1.0,
    )


@pytest.fixture
async def db(tmp_path):
    """An in-memory-like SQLite database for testing."""
    db_path = str(tmp_path / "test.db")
    database = Database(db_path=db_path)
    await database.connect()
    yield database
    await database.close()


@pytest.fixture
def tmp_config(tmp_path):
    """Temporary config directory."""
    config_dir = tmp_path / ".agent-scout"
    config_dir.mkdir()
    return config_dir
