import { describe, it, expect, vi, type Mock } from 'vitest';
import { GetDashboardDataUseCase, type GetDashboardDataOutput } from './GetDashboardDataUseCase';
import type { Logger, UseCaseOutputPort } from '@core/shared/application';

describe('GetDashboardDataUseCase', () => {
  let logger: Logger;
  let output: UseCaseOutputPort<GetDashboardDataOutput> & { present: Mock };
  let useCase: GetDashboardDataUseCase;

  beforeEach(() => {
    logger = {
      debug: vi.fn(),
      info: vi.fn(),
      warn: vi.fn(),
      error: vi.fn(),
    } as unknown as Logger;

    output = {
      present: vi.fn(),
    };

    useCase = new GetDashboardDataUseCase(logger, output);
  });

  it('presents placeholder dashboard metrics and logs retrieval', async () => {
    const result = await useCase.execute();

    expect(result.isOk()).toBe(true);
    expect(output.present).toHaveBeenCalledWith({
      totalUsers: 0,
      activeUsers: 0,
      totalRaces: 0,
      totalLeagues: 0,
    });

    expect((logger.info as unknown as Mock)).toHaveBeenCalled();
  });
});