/**
 * PatientManager: Manages family profiles associated with a single phone number.
 */

class PatientManager {
    constructor() {
        this.profiles = {
            '9876543210': [
                { id: 'P1', name: "Rahul Verma", age: 34, relation: "Self" },
                { id: 'P2', name: "Suman Verma", age: 32, relation: "Spouse" },
                { id: 'P3', name: "Aryan Verma", age: 8, relation: "Child" }
            ]
        };
    }

    getProfiles(phone) {
        return this.profiles[phone] || [];
    }

    addProfile(phone, profile) {
        if (!this.profiles[phone]) {
            this.profiles[phone] = [];
        }
        const id = `P${Math.floor(Math.random() * 10000)}`;
        this.profiles[phone].push({ id, ...profile });
        return id;
    }
}

module.exports = new PatientManager();
