/* Dummy Data Storage for Phase 1 Frontend Only */

window.MandiData = {
    // Initial Parties
    parties: [
        { id: 101, name: "حاجی رمضان", type: "زمیندار", phone: "0300-1234567", city: "اوکاڑہ", balance: 150000, balanceType: "نام" },
        { id: 102, name: "چوہدری اسلم", type: "زمیندار", phone: "0301-7654321", city: "بصیر پور", balance: 25000, balanceType: "جمع" },
        { id: 103, name: "ملک نوید", type: "خریدار", phone: "0322-9876543", city: "لاہور", balance: 500000, balanceType: "نام" },
        { id: 104, name: "شیخ فاروق", type: "خریدار", phone: "0333-1112223", city: "گوجرانوالہ", balance: 0, balanceType: "جمع" },
        { id: 105, name: "بشیر احمد", type: "ڈرائیور", phone: "0345-4445556", city: "ساہیوال", balance: 1200, balanceType: "نام" },
        { id: 106, name: "ارشد بروکر", type: "بروکر", phone: "0311-6667778", city: "اوکاڑہ", balance: 5000, balanceType: "جمع" }
    ],

    // Items / Jins
    items: [
        { id: 1, name: "گندم (Kanak)" },
        { id: 2, name: "مکئی (Makai)" },
        { id: 3, name: "سرسوں (Sarson)" },
        { id: 4, name: "چنا (Chana)" },
        { id: 5, name: "باجرہ (Bajra)" }
    ],

    // Cash & Bank Accounts
    accounts: [
        { id: 1, name: "Cash in Hand", balance: 450000 },
        { id: 2, name: "HBL - 123456789", balance: 1200000 },
        { id: 3, name: "Meezan Bank - 9876", balance: 850000 },
        { id: 4, name: "JazzCash - 0300", balance: 15000 }
    ],

    // Lots (Purchases awaiting sale)
    lots: [
        { id: "L-1001", partyId: 101, partyName: "حاجی رمضان", itemId: 1, itemName: "گندم", weight: 2400, packing: "بوری", status: "درج" },
        { id: "L-1002", partyId: 102, partyName: "چوہدری اسلم", itemId: 2, itemName: "مکئی", weight: 3200, packing: "بوری", status: "درج" },
        { id: "L-1003", partyId: 101, partyName: "حاجی رمضان", itemId: 3, itemName: "سرسوں", weight: 800, packing: "کھلا", status: "درج" }
    ],

    // Ledger Transactions (Dummy History)
    ledger: [
        { date: "2026-03-25", partyId: 103, detail: "بکری پرچی # 2001", debit: 250000, credit: 0, balance: 250000 },
        { date: "2026-03-26", partyId: 103, detail: "نقد وصولی", debit: 0, credit: 150000, balance: 100000 },
        { date: "2026-03-28", partyId: 101, detail: "آمد پرچی # 1001", debit: 0, credit: 120000, balance: 120000 },
        { date: "2026-03-30", partyId: 101, detail: "ادائیگی چیک # 5544", debit: 100000, credit: 0, balance: 20000 }
    ],

    // Common Expenses
    expenses: [
        { date: "2026-03-31", detail: "چائے Munshi", amount: 250 },
        { date: "2026-03-31", detail: "بجلی بل مارچ", amount: 12500 },
        { date: "2026-03-31", detail: "صفائی مزدوری", amount: 1500 }
    ],

    // Counters
    counters: {
        purchase: 1004,
        sale: 2002,
        lot: 1004
    },

    // User Management & Permissions
    departments: ["انتظامیہ", "اکاؤنٹس", "سیلز", "گودام/انوینٹری"],
    roles: ["ایڈمن", "منیجر", "ڈیٹا انٹری آپریٹر"],
    users: [
        { 
            id: 1, 
            username: "admin", 
            fullName: "بابا نوید", 
            password: "****", 
            department: "انتظامیہ", 
            role: "ایڈمن", 
            status: "ایکٹیو",
            permissions: {
                dashboard: { view: true },
                purchase: { view: true, create: true, edit: true, delete: true, print: true },
                sale: { view: true, create: true, edit: true, delete: true, print: true },
                ledger: { view: true, create: true, edit: true, delete: true, print: true },
                cashBank: { view: true, create: true, edit: true, delete: true, print: true },
                expense: { view: true, create: true, edit: true, delete: true, print: true },
                setup: { view: true, create: true, edit: true, delete: true },
                users: { view: true, create: true, edit: true, delete: true }
            }
        },
        { 
            id: 2, 
            username: "mns101", 
            fullName: "محمد اسلم منشی", 
            password: "****", 
            department: "اکاؤنٹس", 
            role: "ڈیٹا انٹری آپریٹر", 
            status: "ایکٹیو",
            permissions: {
                dashboard: { view: true },
                purchase: { view: true, create: true, edit: false, delete: false, print: true },
                sale: { view: true, create: true, edit: false, delete: false, print: true },
                ledger: { view: true, create: false, edit: false, delete: false, print: true },
                cashBank: { view: true, create: true, edit: false, delete: false, print: true },
                expense: { view: true, create: true, edit: false, delete: false, print: true },
                setup: { view: false, create: false, edit: false, delete: false },
                users: { view: false, create: false, edit: false, delete: false }
            }
        }
    ],
    currentUser: { id: 1 } // Simulated logged-in user (Admin by default)
};
