# Project Planning & Development Roadmap

This roadmap outlines the milestones and steps for building the **Khandan (خاندان)** application.

---

## Phase 1: Setup, Custom FTP Deploy, and Concept Docs (Completed)
- [x] Analyze requirements and agree on unified architecture.
- [x] Configure workspace structure and environment variables.
- [x] Write project concept, proposal, and marketing docs.
- [x] Create custom FTP deployment skill `.agents/skills/ftp-deploy/` and script to automate synchronization.

---

## Phase 2: Core Auth & Database Layer (Next Phase)
- [ ] Write `src/database/schema.sql` detailing SQLite table definitions.
- [ ] Build `src/includes/db.php` singleton class using PDO SQLite extension.
- [ ] Create `src/database/seed.php` containing mock family data (users, tree, testaments) for quick testing.
- [ ] Implement Session-based authentication and secure cookie management.
- [ ] Build Patriarch administrative console to generate signup PINs / Invite tokens.

---

## Phase 3: Dynamic Family Tree & Personal Profiles
- [ ] Design PWA files (`manifest.json`, `sw.js`) and asset templates.
- [ ] Implement the dynamic SVG/Canvas-based **Family Tree Viewer** with zooming, panning, and drag-and-drop connections.
- [ ] Create **Profile Pages** loaded when clicking on tree nodes (supporting biography, medical records, oral history recordings).
- [ ] Build the interactive media capture recorder (audio and video clips using HTML5 MediaRecorder API).

---

## Phase 4: Unified Social Feed & Shared Archives
- [ ] Implement the **Clan Feed** interface for viewing family activities.
- [ ] Create posting features tagged under specific categories (hashtag groups: `#اسناد_قدیمی`, `#فیلم_مجلس`, `#سفرنامه`, `#دستور_پخت`).
- [ ] Write upload controllers that sanitize and securely hash uploaded files to local directories.

---

## Phase 5: Legal Vault, Wills & Safety Deposit Box
- [ ] Build the **Digital Safety Deposit Box** view with AES-256-CBC database encryption.
- [ ] Implement **Wills and Testaments** vault supporting text, audio, and video formats with signature uploads.
- [ ] Develop the **Smart Inheritance Calculator** integrating Iranian civil law percentages dynamically computed against the current family tree.
- [ ] Create legal template generators to produce formal PDF petitions for probate and title deeds.

---

## Phase 6: Family Fund & Cooperative System
- [ ] Develop **Family Fund Ledger** tracking monthly contributions, repayments, and loan queues.
- [ ] Implement the **Emergency Assistance Fund** supporting private request mechanisms.
- [ ] Build **Arbitration Panel** for dispute logs and elder mediation.
- [ ] Build **Voting Engine** with Internal Digital Proxy delegation.

---

## Phase 7: Event Notifications & Gift Shop Integration
- [ ] Program scheduled notification engines (sending reminders on birthdays, anniversaries, or memorial days).
- [ ] Build the **Remote Gift Shop** front-end showcasing flowers and gifts with simulated packaging and delivery tracking.
- [ ] Test notification protocols (simulated SMS/email dispatch).

---

## Phase 8: Deployment, Hardening & Final Polishing
- [ ] Execute security audits (SQL injection, XSS checks, file upload restrictions).
- [ ] Deploy workspace changes to production server using the FTP Deploy script.
- [ ] Verify PWA installation and offline capabilities on multiple mobile browsers.
