import React from 'react';
import { View, Text } from 'react-native';

// The main component
const AuthenticationModule = () => {
  return (
    <View>
      <Text>Authentication Module</Text>
    </View>
  );
};

// Module's API
const AuthModule = {
  login: async (username: string, password: string) => {
    // Login logic
    console.log('Logging in...');
    return { success: true, token: 'mock-token' };
  },
  
  logout: async () => {
    // Logout logic
    console.log('Logging out...');
    return { success: true };
  },
  
  getCurrentUser: () => {
    // Get current user
    return { id: 1, name: 'Test User', email: 'test@example.com' };
  }
};

// Module metadata (optional)
export const metadata = {
  name: 'Advanced Authentication',  // Override if desired
  version: '1.2.0',                 // Can be different from config
  features: ['login', 'logout', 'user-management', 'social-login'],
  api: AuthModule
};

// Alternative: Register callback (optional)
export const register = (moduleLoader: any) => {
  moduleLoader.registerModuleMetadata('authentication', metadata);
};

// Default export (required)
export default AuthenticationModule;