/**
 * INT-CLEANUP-004: Barrel export for all types
 * This file exports all types from the types/ directory for clean imports
 */

// Re-export all types from other files
// Note: Some types are exported from multiple files, so we use explicit exports
// to avoid conflicts. api.ts is the primary source for shared types.
// 
// Action 1.1.3.9: Types in api.ts now extend generated types from OpenAPI:
// - User extends VezaBackendApiInternalModelsUser
// - Track extends VezaBackendApiInternalModelsTrack
// - ApiError is from @/schemas/apiSchemas (Zod-inferred from OpenAPI)
// Export basic types
export * from './api';
import { User, PaginatedResponse } from './api';
export type { User, PaginatedResponse };

// Export generated types directly for advanced use cases
// Action 1.1.3.9: Re-export generated types for direct access when needed
export type {
  VezaBackendApiInternalModelsUser,
  VezaBackendApiInternalModelsTrack,
  VezaBackendApiInternalModelsTrackStatus,
  VezaBackendApiInternalModelsPlaylist,
} from './generated/api';
export * from './forms';
export * from './marketplace';
export * from './queryParams';

// Export from dto.ts but exclude ValidationError (already in api.ts)
export type {
  // ValidationError is excluded - use from './api' instead
  ValidationErrors,
} from './dto';

// Export from routes.ts but exclude PaginationParams (already in api.ts)
export type {} from // PaginationParams is excluded - use from './api' instead
'./routes';

// Export from webhook.ts but exclude Webhook and WebhookFailure (already in api.ts)
// These types are already exported from './api', so we don't re-export them here

// Export from websocket.ts but exclude SendMessageRequest and WebSocketMessage (already in api.ts)
// Note: websocket.ts has more specific types, so we export everything except the duplicates
export type {
  BaseWebSocketMessage,
  WebSocketMessageType,
  ChatMessageEvent,
  TypingIndicatorEvent,
  ReadReceiptEvent,
  UserJoinedEvent,
  UserLeftEvent,
  ConversationUpdatedEvent,
  JoinConversationRequest,
  LeaveConversationRequest,
  StartTypingRequest,
  StopTypingRequest,
  MarkAsReadRequest,
  AddReactionRequest,
  RemoveReactionRequest,
  SubscribePlaybackRequest,
  UnsubscribePlaybackRequest,
  PlaybackStateEvent,
  PlaybackSyncRequest,
  NotificationEvent,
  WebSocketErrorEvent,
  PingMessage,
  PongMessage,
  IncomingWebSocketMessage,
  OutgoingWebSocketMessage,
} from './websocket';
export {
  isIncomingWebSocketMessage,
  isOutgoingWebSocketMessage,
  isWebSocketMessageType,
} from './websocket';

// Types globaux de l'application

export interface AuthTokens {
  access_token: string;
  refresh_token: string;
  expires_in: number;
}

export interface LoginRequest {
  email: string;
  password: string;
}

export interface RegisterRequest {
  username: string;
  email: string;
  password: string;
  first_name?: string;
  last_name?: string;
}

// Note: ChatMessage, MessageReaction, Conversation, LibraryItem, and PaginatedResponse
// are already exported from './api' via the 'export * from "./api"' on line 9.
// ApiError is exported from @/schemas/apiSchemas (not from api.ts).
// User and Track are exported from './api' and extend generated types.
// If specific overrides or additional properties are needed, they should be added to api.ts
// or v2-v3-types.ts to maintain a single source of truth.

// WebSocket Events
export interface WebSocketEvent {
  type: string;
  data: unknown;
}

export interface ChatWebSocketEvent extends WebSocketEvent {
  type: 'message' | 'typing' | 'user_joined' | 'user_left' | 'reaction';
  data: {
    conversation_id: string;
    user_id: string;
    content?: string;
    emoji?: string;
    timestamp: string;
  };
}

// UI State
export interface UIState {
  theme: 'light' | 'dark' | 'system';
  language: 'en' | 'fr';
  sidebarOpen: boolean;
  notifications: Notification[];
}

export interface Notification {
  id: string;
  type:
    | 'info'
    | 'success'
    | 'warning'
    | 'error'
    | 'like'
    | 'follow'
    | 'mention'
    | 'sale'
    | 'security';
  title: string;
  message: string;
  timestamp: string;
  read: boolean;
  actionUrl?: string;
  user?: User;
}

export interface ChatStats {
  active_users: number;
  total_messages: number;
  rooms_active?: number;
}

// Export additional types from v2/v3
export * from './v2-v3-types';
