// src/services/firebase-mock.js

export const initializeApp = () =>
  console.log('initializeApp was called!!!!!!') || {};

// Mock Firestore
export const getFirestore = () =>
  console.log('getFirestore was called!!!!!!') || {
    collection: () => ({
      doc: () => ({
        get: () => Promise.resolve({ data: () => ({}) }),
        set: () => Promise.resolve(),
      }),
    }),
  };

// Mock Auth
export const getAuth = () =>
  console.log('getAuth was called!!!!!!') || {
    signInAnonymously: () => Promise.resolve({}),
  };

// Mock Realtime Database
export const getDatabase = () =>
  console.log('getDatabase was called!!!!!!') || {
    ref: () => {
      console.log('getDatabase REF was called!!!!!!');
      return {
        on: (eventType, callback) => {
          // Mock implementation of 'on'
          console.log(`Mock on called with event type: ${eventType}`);
        },
        off: () => {
          // Mock implementation of 'off'
          console.log('Mock off called to remove listeners');
        },
        set: (value) => {
          console.log(`Mock set called with value: ${JSON.stringify(value)}`);
          return Promise.resolve();
        },
        once: (eventType) => {
          console.log(`Mock once called with event type: ${eventType}`);
          return Promise.resolve({ val: () => ({}) });
        },
      };
    },
  };

// Mock Analytics
export const getAnalytics = () =>
  console.log('getAnalytics was called!!!!!!') || {
    logEvent: (eventName, eventParams) => {
      console.log(`Mock logEvent called with event: ${eventName}`, eventParams);
    },
    setCurrentScreen: (screenName) => {
      console.log(`Mock setCurrentScreen called with screen: ${screenName}`);
    },
    setUserId: (userId) => {
      console.log(`Mock setUserId called with user ID: ${userId}`);
    },
    setUserProperties: (properties) => {
      console.log(`Mock setUserProperties called with properties:`, properties);
    },
  };
