# File Manifest

Complete list of all files in the Informatiq Smart Google Pricing plugin.

## Core Plugin Files

### Main Files
- **`informatiq-smart-google-pricing.php`** - Main plugin file with activation/deactivation hooks
- **`uninstall.php`** - Clean uninstall script (removes all data)
- **`composer.json`** - Composer configuration for Google API Client
- **`.gitignore`** - Git ignore rules (includes vendor for distribution)

## Includes Directory (`includes/`)

Core functionality classes:

- **`class-informatiq-sp-logger.php`** - Logging system
  - WC_Logger integration
  - Custom database table for price update logs
  - Methods: `log_price_update()`, `get_todays_logs()`, `clear_old_logs()`

- **`class-informatiq-sp-google-api.php`** - Google Merchant Center API
  - Service Account authentication
  - Product matching via SKU/GTIN
  - Competitive pricing retrieval
  - Methods: `get_competitive_price()`, `test_connection()`

- **`class-informatiq-sp-price-updater.php`** - Price calculation logic
  - Tax-aware pricing (handles WooCommerce tax settings)
  - Minimum margin protection
  - Random offset calculation (0.05-0.20)
  - In-stock product filtering
  - Methods: `process_all_products()`, `process_product_by_id()`

- **`class-informatiq-sp-scheduler.php`** - WP Cron automation
  - Daily/twice daily/6-hour schedules
  - Automatic price update execution
  - Last run tracking
  - Methods: `run_daily_update()`, `trigger_manual_update()`, `reschedule()`

## Admin Directory (`admin/`)

- **`class-informatiq-sp-admin.php`** - WordPress admin interface
  - Settings page under WooCommerce menu
  - Form fields for all settings
  - AJAX handlers for manual sync and connection test
  - Logs display
  - Methods: `render_admin_page()`, `handle_manual_sync()`, `handle_test_connection()`

## Assets Directory (`assets/`)

### CSS (`assets/css/`)
- **`admin.css`** - Admin page styling
  - Responsive layout (sidebar + main content)
  - Status boxes and buttons
  - Loading states and animations
  - Table styling for logs

### JavaScript (`assets/js/`)
- **`admin.js`** - Admin interactivity
  - Manual sync AJAX handler
  - Test connection AJAX handler
  - Loading states
  - Error/success message display

## Vendor Directory (`vendor/`)

- **`autoload.php`** - Custom autoloader
  - Works with Composer-installed libraries
  - Works with manually placed libraries
  - Supports both PSR-4 and old-style class names
  - Shows admin notice if dependencies missing

**Expected structure after setup:**
```
vendor/
├── autoload.php (included in plugin)
├── google/
│   ├── apiclient/
│   └── apiclient-services/
├── guzzlehttp/
├── psr/
├── firebase/
└── monolog/
```

## Languages Directory (`languages/`)

- **`informatiq-smart-pricing.pot`** - Translation template
  - All translatable strings
  - Ready for localization

## Documentation Files

### User Documentation
- **`README.md`** - Complete plugin documentation
  - Features overview
  - Installation instructions
  - Configuration guide
  - How it works
  - API reference

- **`QUICKSTART.md`** - 10-minute setup guide
  - Quick setup for developers
  - Quick setup for end users
  - Common troubleshooting
  - Next steps

- **`INSTALLATION.md`** - Detailed installation guide
  - Google Service Account setup
  - Plugin configuration
  - Product requirements
  - Advanced configuration
  - Security recommendations

- **`VENDOR-SETUP.md`** - Vendor library setup guide
  - Manual download instructions
  - Composer installation
  - Directory structure
  - Simplified installation methods

### Developer Documentation
- **`FILE-MANIFEST.md`** - This file
  - Complete file listing
  - Purpose of each file
  - Code references

## Utility Scripts

- **`setup-vendor.sh`** - Automated vendor setup script
  - Checks for Composer
  - Installs Google API Client
  - Optimizes autoloader
  - Shows installation summary
  - Usage: `./setup-vendor.sh`

## File Statistics

### PHP Files
- Total: 7 core PHP files
- Lines of code: ~2,500+ lines
- Classes: 5 main classes
- Functions: 50+ methods

### Assets
- CSS: 1 file (~300 lines)
- JavaScript: 1 file (~150 lines)

### Documentation
- Markdown files: 5 guides
- Total documentation: ~1,500+ lines

## Code Organization

### Naming Conventions
- **Classes**: `Informatiq_SP_*` (WordPress style)
- **Functions**: `informatiq_sp_*` prefix
- **Options**: `informatiq_sp_*` prefix
- **Hooks**: `informatiq_sp_*` prefix
- **Text Domain**: `informatiq-smart-pricing`

### Database Tables
- **`{prefix}_informatiq_sp_logs`** - Price update logs
  - Columns: id, product_id, product_name, old_price, new_price, competitor_price, message, created_at
  - Created on activation
  - Dropped on uninstall

### WordPress Options
- `informatiq_sp_merchant_id` - Google Merchant ID
- `informatiq_sp_service_account` - Service Account JSON
- `informatiq_sp_minimum_margin` - Minimum margin %
- `informatiq_sp_auto_update_enabled` - Enable/disable automation
- `informatiq_sp_update_frequency` - Cron frequency
- `informatiq_sp_last_run_start` - Last run start time
- `informatiq_sp_last_run_end` - Last run end time
- `informatiq_sp_last_run_results` - Last run results array

### Cron Events
- **`informatiq_sp_daily_price_update`** - Main cron event
  - Frequencies: daily, twice_daily, every_6_hours
  - Registered on activation
  - Cleared on deactivation

## Key Code Locations

### Main Plugin Initialization
- Plugin bootstrap: `informatiq-smart-google-pricing.php:66`
- Class includes: `informatiq-smart-google-pricing.php:99`
- Activation hook: `informatiq-smart-google-pricing.php:122`

### Google API Integration
- Authentication: `class-informatiq-sp-google-api.php:51`
- Product search: `class-informatiq-sp-google-api.php:108`
- Price fetching: `class-informatiq-sp-google-api.php:143`

### Price Calculation
- Main processor: `class-informatiq-sp-price-updater.php:37`
- Tax calculation: `class-informatiq-sp-price-updater.php:197`
- Minimum price check: `class-informatiq-sp-price-updater.php:230`

### Admin Interface
- Settings page: `class-informatiq-sp-admin.php:84`
- Manual sync: `class-informatiq-sp-admin.php:478`
- AJAX handlers: `class-informatiq-sp-admin.php:478-545`

### Logging
- Database logging: `class-informatiq-sp-logger.php:85`
- WC Logger: `class-informatiq-sp-logger.php:47-82`
- Log retrieval: `class-informatiq-sp-logger.php:120-143`

## Distribution Checklist

When distributing the plugin:

- [ ] Run `./setup-vendor.sh` or `composer install --no-dev`
- [ ] Verify `vendor/google/apiclient/` exists
- [ ] Test activation in WordPress
- [ ] Test connection to Google API
- [ ] Run manual sync to verify functionality
- [ ] Check error logs for any issues
- [ ] Create ZIP with all files including vendor/
- [ ] Document any system requirements

## File Size

**Without vendor directory:**
- ~500 KB (plugin code only)

**With vendor directory:**
- ~10-15 MB uncompressed
- ~2-3 MB when ZIP compressed

This is acceptable for WordPress plugin distribution and eliminates the need for end users to run Composer.

## Version Control

### Included in Git
- All plugin code
- All documentation
- Vendor directory (for distribution)
- composer.json (for development)

### Excluded from Git
- composer.lock
- Development files
- IDE configurations
- OS-specific files (.DS_Store, etc.)

## Support Files

For support and maintenance, check:
- **WooCommerce Logs**: `WooCommerce > Status > Logs`
- **Plugin Logs**: Custom table `wp_informatiq_sp_logs`
- **Cron Status**: Use WP Crontrol plugin to view scheduled events
- **Error Log**: Standard WordPress/PHP error logs

---

**Total Files**: 17 plugin files + vendor dependencies
**Ready for Production**: Yes ✓
**WordPress.org Ready**: Yes (with minor modifications to readme.txt format)
