import React from 'react';
import { describe, expect, it, vi } from 'vitest';
import { render, screen } from '@testing-library/react';

vi.mock('@tamagui/stacks', () => ({
  YStack: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
  XStack: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
}));

vi.mock('@tamagui/text', () => ({
  SizableText: ({ children }: { children: React.ReactNode }) => <span>{children}</span>,
}));

vi.mock('@tamagui/button', () => ({
  Button: ({ children, ...rest }: { children: React.ReactNode }) => (
    <button type="button" {...rest}>
      {children}
    </button>
  ),
}));

vi.mock('../components/AppShell', () => ({
  default: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
}));

vi.mock('../components/SurfaceCard', () => ({
  default: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
}));

vi.mock('../services/uploadApi', () => ({
  useUploadQueue: () => ({
    items: [],
    loading: false,
    retryAll: vi.fn(),
    clearFinished: vi.fn(),
    refresh: vi.fn(),
    remove: vi.fn(),
  }),
}));

vi.mock('../context/EventDataContext', () => ({
  useEventData: () => ({ token: 'token' }),
}));

vi.mock('@/guest/services/pendingUploadsApi', () => ({
  fetchPendingUploadsSummary: vi.fn().mockResolvedValue({ items: [], totalCount: 0 }),
}));

vi.mock('@/guest/i18n/useTranslation', () => ({
  useTranslation: () => ({
    t: (key: string, arg2?: Record<string, string | number> | string, arg3?: string) =>
      typeof arg2 === 'string' || arg2 === undefined ? (arg2 ?? arg3 ?? key) : (arg3 ?? key),
    locale: 'de',
  }),
}));

vi.mock('@/guest/i18n/LocaleContext', () => ({
  useLocale: () => ({ locale: 'de' }),
}));

vi.mock('@/hooks/use-appearance', () => ({
  useAppearance: () => ({ resolved: 'light' }),
}));

import UploadQueueScreen from '../screens/UploadQueueScreen';

describe('UploadQueueScreen', () => {
  it('renders empty queue state', () => {
    render(<UploadQueueScreen />);

    expect(screen.getByText('Uploads')).toBeInTheDocument();
  });
});
