# WP BnB Implementation Plan This document outlines the implementation plan for the WP BnB Management plugin. ## Phase 1: Foundation (v0.0.x - v0.1.0) ### v0.0.1 - Initial Setup (Current) - [x] Project structure and configuration files - [x] Composer dependencies (Twig, License Client) - [x] Git submodule for license client - [x] Main plugin file with version checks - [x] Plugin singleton class - [x] License Manager integration - [x] Admin menu and settings pages - [x] CI/CD pipeline for releases - [x] Basic CSS and JS assets - [x] Documentation (README, PLAN, CLAUDE) ### v0.1.0 - Core Data Structures (Current) - [x] Custom Post Type: Buildings - Meta fields: address, contact, description, images - Admin columns and filtering - Gutenberg block for display (planned for Phase 6) - [x] Custom Post Type: Rooms - Meta fields: building reference, capacity, amenities, images - Relationship to Buildings (parent) - Admin columns with building filter - Gutenberg block for display (planned for Phase 6) - [x] Custom Taxonomy: Room Types - Standard, Suite, Family, Accessible, etc. - Hierarchical structure - [x] Custom Taxonomy: Amenities - WiFi, Parking, Breakfast, etc. - Non-hierarchical (tags) ## Phase 2: Pricing System (v0.2.0) - Complete ### Pricing Classes - [x] Short-term pricing (per night, 1-6 nights) - [x] Mid-term pricing (per week, 1-4 weeks) - [x] Long-term pricing (per month, 1+ months) ### Price Configuration - [x] Room-level price settings - [x] Seasonal pricing periods - [x] Weekend/weekday differentiation - [x] Currency formatting and display ### Price Calculation - [x] Automatic tier detection based on duration - [x] Price breakdown display - [x] Discount handling (via seasonal modifiers) ## Phase 3: Booking System (v0.3.0) - Complete ### Custom Post Type: Bookings - [x] Guest reference - [x] Room reference - [x] Check-in/check-out dates - [x] Status (pending, confirmed, checked-in, checked-out, cancelled) - [x] Price calculation and storage - [x] Notes field ### Calendar Integration - [x] Availability calendar per room - [x] Availability calendar per building - [x] Date range picker for bookings - [x] Conflict detection ### Booking Workflow - [x] Booking creation (admin) - [x] Status transitions - [x] Email notifications - [x] Booking confirmation ## Phase 4: Guest Management (v0.4.0) - Complete ### Custom Post Type: Guests - [x] Personal information (name, email, phone) - [x] Address fields - [x] ID/Passport information - [x] Booking history reference - [x] Notes and preferences ### Privacy & Compliance - [x] GDPR compliance features - [x] Data export functionality - [x] Data deletion on request - [x] Consent tracking ## Phase 5: Additional Services (v0.5.0) - Complete ### Service Options - [x] Custom Post Type: Services - [x] Price per service (or included) - [x] Per-booking or per-night pricing - [x] Service categories ### Booking Services - [x] Service selection during booking - [x] Automatic price calculation - [x] Service summary display ## Phase 6: Frontend Features (v0.6.0) - Complete ### Search & Filtering - [x] Room search with filters - Date range (availability) - Capacity - Room type - Amenities - Price range - Building ### Display Components - [x] Building list/grid shortcode - [x] Room list/grid shortcode - [x] Room detail template - [x] Availability widget ### Gutenberg Blocks - [x] Building block - [x] Room block - [x] Room search block - [x] Buildings list block - [x] Rooms list block ### Widgets - [x] Similar rooms widget - [x] Building rooms widget - [x] Availability calendar widget ## Phase 7: Contact Form 7 Integration (v0.7.0) - Complete ### Booking Request Form - [x] Custom CF7 tags for rooms/dates - [x] Form validation - [x] Booking creation on submission - [x] Email notifications ### Inquiry Form - [x] General inquiry handling - [x] Room-specific inquiries - [x] Auto-response templates (uses default CF7 mail templates) ## Phase 8: Dashboard & Reports (v0.8.0) - Complete ### Admin Dashboard - [x] Occupancy overview - [x] Upcoming check-ins/check-outs - [x] Revenue summary - [x] Quick actions ### Reports - [x] Occupancy report - [x] Revenue report - [x] Guest statistics - [x] Export functionality (CSV, PDF) ## Phase 9: Prometheus Metrics (v0.9.0) - Complete - [x] Meaningful Metrics for this Plugin: - Inventory: buildings, rooms by status, services by status - Bookings: by status, check-ins/check-outs today, upcoming, avg duration - Guests: total, by status, repeat guests, new this month - Occupancy: current rate, monthly rate, occupied rooms, bed capacity - Revenue: this month, YTD, average booking value, services revenue - [x] Example Grafana Dashboard: - Pre-configured dashboard JSON at `assets/grafana/wp-bnb-dashboard.json` - Automatic registration with wp-prometheus - 24 panels with gauges, pie charts, and stat displays - [x] Update settings page to enable/disable metrics ### Phase 10: API Endpoints (v0.10.0) - Complete - [x] REST API for rooms (list, details, availability, calendar) - [x] REST API for availability (search available rooms) - [x] REST API for bookings (CRUD, status transitions) - [x] REST API for buildings, guests, services, pricing - [x] Authentication (Application Passwords, edit_posts capability) - [x] Transient-based rate limiting with tiered limits - [x] API settings tab with enable/disable toggles ### Phase 11: WooCommerce Integration (v0.11.0) - [ ] Payment processing - [ ] Invoice generation - [ ] Order management - [ ] Refund handling ## Phase 12: Security Audit (v0.12.0) - [ ] Check for Wordpress best-practices - [ ] Review the code for OWASP Top 10, including XSS, XSRF, SQLi and other critical threads - [ ] Test the API-Endpoints against a local live system under for common vulnerabilities ## Future Considerations (v1.0.0+) ### Multi-language Support - [ ] Full translation support - [ ] WPML compatibility - [ ] Polylang compatibility ### Advanced Features - [ ] Channel manager integration - [ ] iCal sync - [ ] Automated pricing rules - [ ] Loyalty program support ## Technical Architecture ### Directory Structure ```text wp-bnb/ ├── wp-bnb.php # Main plugin file ├── composer.json # Dependencies ├── src/ # PHP source (PSR-4) │ ├── Plugin.php # Main plugin class │ ├── License/ # License management │ │ └── Manager.php │ ├── PostTypes/ # Custom post types │ │ ├── Building.php │ │ ├── Room.php │ │ ├── Booking.php │ │ ├── Guest.php │ │ └── Service.php │ ├── Taxonomies/ # Custom taxonomies │ │ ├── RoomType.php │ │ └── Amenity.php │ ├── Admin/ # Admin functionality │ │ ├── Dashboard.php │ │ ├── Settings.php │ │ └── MetaBoxes.php │ ├── Frontend/ # Frontend functionality │ │ ├── Shortcodes.php │ │ ├── Widgets.php │ │ └── Search.php │ ├── Blocks/ # Gutenberg blocks │ │ ├── Building.php │ │ ├── Room.php │ │ └── Search.php │ ├── Pricing/ # Pricing logic │ │ ├── Calculator.php │ │ └── PricingTier.php │ ├── Booking/ # Booking logic │ │ ├── Manager.php │ │ ├── Calendar.php │ │ └── Workflow.php │ └── Integration/ # Third-party integrations │ └── CF7.php ├── templates/ # Twig templates │ ├── admin/ │ ├── frontend/ │ └── email/ ├── assets/ # CSS, JS, images │ ├── css/ │ ├── js/ │ └── images/ ├── languages/ # Translation files ├── lib/ # Git submodules │ └── wc-licensed-product-client/ └── vendor/ # Composer dependencies ``` ### Database Tables (Custom) For performance with large datasets, custom tables may be added: - `{prefix}bnb_availability` - Room availability cache - `{prefix}bnb_prices` - Price history and seasonal rates - `{prefix}bnb_booking_services` - Many-to-many booking/service relation ### Hooks and Filters The plugin will provide extensive hooks for customization: - `wp_bnb_before_booking_create` - `wp_bnb_after_booking_create` - `wp_bnb_calculate_price` - `wp_bnb_room_availability` - `wp_bnb_booking_statuses` - `wp_bnb_email_templates` ## Version Milestones | Version | Focus | Target | | ------- | ----------------------- | -------- | | 0.0.1 | Initial setup | Complete | | 0.1.0 | Data structures | Complete | | 0.2.0 | Pricing | Complete | | 0.3.0 | Bookings | Complete | | 0.4.0 | Guests | Complete | | 0.5.0 | Services | Complete | | 0.6.0 | Frontend | Complete | | 0.7.0 | CF7 Integration | Complete | | 0.8.0 | Dashboard | Complete | | 0.9.0 | Prometheus Metrics | Complete | | 0.10.0 | API Endpoints | Complete | | 0.11.0 | WooCommerce Integration | TBD | | 0.12.0 | Security Audit | TBD | | 1.0.0 | Stable Release | TBD |