# LnP360 Mobile App
## Kenyan Pension & Life Insurance Management System

React Native mobile application for members to manage their pension and life insurance accounts.

---

## Features

### ✅ Core Features Implemented

1. **Authentication**
   - Login with username/password
   - Token-based authentication
   - Secure token storage
   - Auto-logout on token expiry

2. **Dashboard**
   - Account balance overview
   - Quick statistics
   - Recent activity
   - Quick actions

3. **Contributions**
   - View contribution history
   - Contribution details
   - Filter and search

4. **Life Insurance Policies**
   - View active policies
   - Policy details
   - Premium payment history

5. **Withdrawals**
   - View withdrawal history
   - Request new withdrawal
   - Track withdrawal status

6. **Profile & Settings**
   - View profile
   - Update information
   - Change password
   - Logout

---

## Project Structure

```
mobile-app/
├── App.js                 # Main app entry point
├── package.json           # Dependencies
├── src/
│   ├── screens/          # Screen components
│   │   ├── auth/        # Authentication screens
│   │   ├── dashboard/   # Dashboard screen
│   │   ├── contributions/
│   │   ├── policies/
│   │   ├── withdrawals/
│   │   ├── profile/
│   │   └── ...
│   ├── services/         # API services
│   │   ├── ApiService.js
│   │   ├── AuthService.js
│   │   └── MemberService.js
│   ├── components/       # Reusable components
│   └── utils/          # Utility functions
└── README.md
```

---

## Setup Instructions

### Prerequisites

- Node.js 18+
- React Native CLI
- Android Studio (for Android)
- Xcode (for iOS - macOS only)

### Installation

1. **Install Dependencies**
   ```bash
   cd mobile-app
   npm install
   ```

2. **Configure API Base URL**
   
   Edit `src/services/ApiService.js`:
   ```javascript
   const API_BASE_URL = 'https://your-domain.com/api/v1';
   ```

3. **Run on Android**
   ```bash
   npm run android
   ```

4. **Run on iOS**
   ```bash
   npm run ios
   ```

---

## API Integration

The app integrates with the REST API endpoints:

- **Authentication**: `/api/v1/auth`
- **Members**: `/api/v1/members`
- **Contributions**: `/api/v1/contributions`
- **Withdrawals**: `/api/v1/withdrawals`
- **Policies**: `/api/v1/policies`
- **Premiums**: `/api/v1/premiums`
- **Claims**: `/api/v1/claims`
- **Statements**: `/api/v1/statements`
- **Beneficiaries**: `/api/v1/beneficiaries`
- **Analytics**: `/api/v1/analytics`

See `API_DOCUMENTATION.md` for complete API reference.

---

## Screens

### Authentication
- **LoginScreen**: User login

### Main Tabs
- **Dashboard**: Account overview and quick actions
- **Contributions**: Contribution history
- **Policies**: Life insurance policies
- **Withdrawals**: Withdrawal requests
- **Profile**: User profile and settings

### Detail Screens
- **ContributionDetails**: View contribution details
- **PolicyDetails**: View policy information
- **WithdrawalRequest**: Request new withdrawal
- **Statement**: View account statement
- **Beneficiaries**: Manage beneficiaries
- **Premiums**: Premium payment history
- **Claims**: File and view claims

---

## Development

### Running the App

```bash
# Start Metro bundler
npm start

# Run on Android
npm run android

# Run on iOS
npm run ios
```

### Building for Production

**Android:**
```bash
cd android
./gradlew assembleRelease
```

**iOS:**
```bash
cd ios
xcodebuild -workspace LnP360.xcworkspace -scheme LnP360 -configuration Release
```

---

## Dependencies

### Core
- `react`: 18.2.0
- `react-native`: 0.72.6
- `@react-navigation/native`: Navigation
- `@react-navigation/stack`: Stack navigator
- `@react-navigation/bottom-tabs`: Tab navigator

### Services
- `axios`: HTTP client
- `@react-native-async-storage/async-storage`: Local storage

### UI
- `react-native-vector-icons`: Icons
- `react-native-paper`: Material Design components
- `react-native-toast-message`: Toast notifications

### Charts
- `react-native-chart-kit`: Charts and graphs
- `react-native-svg`: SVG support

---

## Security

- ✅ Token-based authentication
- ✅ Secure token storage (AsyncStorage)
- ✅ Automatic token refresh
- ✅ API request interceptors
- ✅ Error handling

---

## Next Steps

1. **Complete Remaining Screens**
   - Beneficiaries management
   - Premium payment
   - Claims filing
   - Statement generation

2. **Add Features**
   - Push notifications
   - Biometric authentication
   - Offline mode
   - Document upload

3. **Enhancements**
   - Dark mode
   - Multi-language support
   - Advanced charts
   - Payment integration (M-Pesa)

---

## Support

For API documentation, see `../API_DOCUMENTATION.md`

For system documentation, see `../SYSTEM_FEATURES_DOCUMENTATION.md`

---

**Version:** 1.0.0  
**Last Updated:** 2024
