





















const db = require('../models');
const Users = db.users;






const Organizations = db.organizations;

const Tenants = db.tenants;

const Products = db.products;

const Warehouses = db.warehouses;

const InventoryItems = db.inventory_items;

const InventoryMovements = db.inventory_movements;

const Customers = db.customers;

const Orders = db.orders;

const OrderItems = db.order_items;

const Invoices = db.invoices;

const Payments = db.payments;

const CommissionPlans = db.commission_plans;

const CommissionRules = db.commission_rules;

const Commissions = db.commissions;

const Payouts = db.payouts;

const BonusPrograms = db.bonus_programs;

const ReferralLinks = db.referral_links;

const ResellerStores = db.reseller_stores;

const StorePages = db.store_pages;

const Notifications = db.notifications;

const AiInsights = db.ai_insights;

const SalesTargets = db.sales_targets;







const OrganizationsData = [
    
    {
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Marie Curie",
            
        
    
    },
    
];



const TenantsData = [
    
    {
    
        
        
            
                "tenant_name": "VORTA Demo Brand",
            
        
    
        
        
            
                "legal_name": "PT Vorta Nusantara",
            
        
    
        
        
            
                "domain": "vorta-demo.id",
            
        
    
        
        
            
                "industry": "FMCG",
            
        
    
        
        
            
                "default_currency": "IDR",
            
        
    
        
        
            
                "timezone": "Asia/Jakarta",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "support_email": "support@vorta-demo.id",
            
        
    
        
        
            
                "support_phone": "+622112345678",
            
        
    
        
        
            
                "address": "Jl. Jendral Sudirman No. 10, Jakarta",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "tenant_name": "Nusantara Herbal Co",
            
        
    
        
        
            
                "legal_name": "PT Nusantara Herbal Sejahtera",
            
        
    
        
        
            
                "domain": "nusantara-herbal.id",
            
        
    
        
        
            
                "industry": "Herbal",
            
        
    
        
        
            
                "default_currency": "IDR",
            
        
    
        
        
            
                "timezone": "Asia/Jakarta",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "support_email": "cs@nusantara-herbal.id",
            
        
    
        
        
            
                "support_phone": "+622187654321",
            
        
    
        
        
            
                "address": "Jl. Diponegoro No. 21, Bandung",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "tenant_name": "Cantik Lokal Beauty",
            
        
    
        
        
            
                "legal_name": "CV Cantik Lokal",
            
        
    
        
        
            
                "domain": "cantiklokal.co.id",
            
        
    
        
        
            
                "industry": "Kosmetik",
            
        
    
        
        
            
                "default_currency": "IDR",
            
        
    
        
        
            
                "timezone": "Asia/Jakarta",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "support_email": "hello@cantiklokal.co.id",
            
        
    
        
        
            
                "support_phone": "+623151234567",
            
        
    
        
        
            
                "address": "Jl. Tunjungan No. 5, Surabaya",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "tenant_name": "Kopi Rakyat Roastery",
            
        
    
        
        
            
                "legal_name": "PT Kopi Rakyat Indonesia",
            
        
    
        
        
            
                "domain": "kopirakyat.id",
            
        
    
        
        
            
                "industry": "Makanan dan Minuman",
            
        
    
        
        
            
                "default_currency": "IDR",
            
        
    
        
        
            
                "timezone": "Asia/Jakarta",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "support_email": "care@kopirakyat.id",
            
        
    
        
        
            
                "support_phone": "+626117778888",
            
        
    
        
        
            
                "address": "Jl. Gatot Subroto No. 88, Medan",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ProductsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "product_name": "Herbal Immunity Drink 250ml",
            
        
    
        
        
            
                "sku": "NUS-HID-250",
            
        
    
        
        
            
                "barcode": "8999999000011",
            
        
    
        
        
            
                "product_status": "active",
            
        
    
        
        
            
                "brand": "Nusantara Herbal",
            
        
    
        
        
            
                "category": "Minuman Herbal",
            
        
    
        
        
            
                "unit": "bottle",
            
        
    
        
        
            
                "weight_grams": 280,
            
        
    
        
        
            
                "length_cm": 6,
            
        
    
        
        
            
                "width_cm": 6,
            
        
    
        
        
            
                "height_cm": 18,
            
        
    
        
        
            
                "cost_price": 8000,
            
        
    
        
        
            
                "retail_price": 15000,
            
        
    
        
        
            
                "reseller_price": 12500,
            
        
    
        
        
            
                "agent_price": 11500,
            
        
    
        
        
            
                "distributor_price": 10500,
            
        
    
        
        
            
                "low_stock_threshold": 50,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "short_description": "Minuman herbal untuk daya tahan tubuh",
            
        
    
        
        
            
                "description": "Formula herbal pilihan untuk membantu menjaga stamina harian.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "product_name": "Bright Glow Serum 30ml",
            
        
    
        
        
            
                "sku": "CLB-BGS-30",
            
        
    
        
        
            
                "barcode": "8999999000028",
            
        
    
        
        
            
                "product_status": "active",
            
        
    
        
        
            
                "brand": "Cantik Lokal",
            
        
    
        
        
            
                "category": "Skincare",
            
        
    
        
        
            
                "unit": "bottle",
            
        
    
        
        
            
                "weight_grams": 120,
            
        
    
        
        
            
                "length_cm": 4,
            
        
    
        
        
            
                "width_cm": 4,
            
        
    
        
        
            
                "height_cm": 10,
            
        
    
        
        
            
                "cost_price": 35000,
            
        
    
        
        
            
                "retail_price": 79000,
            
        
    
        
        
            
                "reseller_price": 69000,
            
        
    
        
        
            
                "agent_price": 64000,
            
        
    
        
        
            
                "distributor_price": 60000,
            
        
    
        
        
            
                "low_stock_threshold": 30,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "short_description": "Serum pencerah wajah",
            
        
    
        
        
            
                "description": "Serum dengan niacinamide untuk membantu tampilan kulit lebih cerah.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "product_name": "Kopi Arabica Gayo 200g",
            
        
    
        
        
            
                "sku": "KOP-ARG-200",
            
        
    
        
        
            
                "barcode": "8999999000035",
            
        
    
        
        
            
                "product_status": "draft",
            
        
    
        
        
            
                "brand": "Kopi Rakyat",
            
        
    
        
        
            
                "category": "Kopi",
            
        
    
        
        
            
                "unit": "bag",
            
        
    
        
        
            
                "weight_grams": 220,
            
        
    
        
        
            
                "length_cm": 12,
            
        
    
        
        
            
                "width_cm": 6,
            
        
    
        
        
            
                "height_cm": 20,
            
        
    
        
        
            
                "cost_price": 45000,
            
        
    
        
        
            
                "retail_price": 85000,
            
        
    
        
        
            
                "reseller_price": 78000,
            
        
    
        
        
            
                "agent_price": 74000,
            
        
    
        
        
            
                "distributor_price": 70000,
            
        
    
        
        
            
                "low_stock_threshold": 25,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "short_description": "Biji kopi Arabica Gayo",
            
        
    
        
        
            
                "description": "Roast medium untuk rasa seimbang dengan aroma floral.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "product_name": "Wireless Earbuds Pro",
            
        
    
        
        
            
                "sku": "GMD-WEP-01",
            
        
    
        
        
            
                "barcode": "8999999000042",
            
        
    
        
        
            
                "product_status": "active",
            
        
    
        
        
            
                "brand": "Gadget Mart",
            
        
    
        
        
            
                "category": "Audio",
            
        
    
        
        
            
                "unit": "set",
            
        
    
        
        
            
                "weight_grams": 180,
            
        
    
        
        
            
                "length_cm": 10,
            
        
    
        
        
            
                "width_cm": 10,
            
        
    
        
        
            
                "height_cm": 4,
            
        
    
        
        
            
                "cost_price": 220000,
            
        
    
        
        
            
                "retail_price": 399000,
            
        
    
        
        
            
                "reseller_price": 369000,
            
        
    
        
        
            
                "agent_price": 349000,
            
        
    
        
        
            
                "distributor_price": 329000,
            
        
    
        
        
            
                "low_stock_threshold": 20,
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "short_description": "Earbuds dengan ANC",
            
        
    
        
        
            
                "description": "TWS dengan active noise cancelling dan baterai tahan lama.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const WarehousesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "warehouse_name": "Jakarta Main Warehouse",
            
        
    
        
        
            
                "code": "JKT-01",
            
        
    
        
        
            
                "contact_name": "Budi Santoso",
            
        
    
        
        
            
                "contact_phone": "+622112223333",
            
        
    
        
        
            
                "address": "Jl. Industri No. 3, Jakarta",
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "warehouse_name": "Bandung Fulfillment Hub",
            
        
    
        
        
            
                "code": "BDG-01",
            
        
    
        
        
            
                "contact_name": "Rina Kurnia",
            
        
    
        
        
            
                "contact_phone": "+622220001111",
            
        
    
        
        
            
                "address": "Jl. Soekarno Hatta No. 55, Bandung",
            
        
    
        
        
            
                "is_default": false,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "warehouse_name": "Surabaya East Warehouse",
            
        
    
        
        
            
                "code": "SBY-01",
            
        
    
        
        
            
                "contact_name": "Hendra Wijaya",
            
        
    
        
        
            
                "contact_phone": "+623199998888",
            
        
    
        
        
            
                "address": "Jl. Raya Darmo No. 20, Surabaya",
            
        
    
        
        
            
                "is_default": false,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "warehouse_name": "Medan North Hub",
            
        
    
        
        
            
                "code": "MDN-01",
            
        
    
        
        
            
                "contact_name": "Putri Siregar",
            
        
    
        
        
            
                "contact_phone": "+626177770000",
            
        
    
        
        
            
                "address": "Jl. Ring Road No. 7, Medan",
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InventoryItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "on_hand_qty": 320,
            
        
    
        
        
            
                "reserved_qty": 25,
            
        
    
        
        
            
                "available_qty": 295,
            
        
    
        
        
            
                "last_counted_at": new Date('2026-06-01T03:00:00Z'),
            
        
    
        
        
            
                "note": "Cycle count June batch A",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "on_hand_qty": 120,
            
        
    
        
        
            
                "reserved_qty": 10,
            
        
    
        
        
            
                "available_qty": 110,
            
        
    
        
        
            
                "last_counted_at": new Date('2026-06-02T03:00:00Z'),
            
        
    
        
        
            
                "note": "Top seller stock",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "on_hand_qty": 80,
            
        
    
        
        
            
                "reserved_qty": 5,
            
        
    
        
        
            
                "available_qty": 75,
            
        
    
        
        
            
                "last_counted_at": new Date('2026-06-03T03:00:00Z'),
            
        
    
        
        
            
                "note": "Roastery fresh stock",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "on_hand_qty": 60,
            
        
    
        
        
            
                "reserved_qty": 8,
            
        
    
        
        
            
                "available_qty": 52,
            
        
    
        
        
            
                "last_counted_at": new Date('2026-06-04T03:00:00Z'),
            
        
    
        
        
            
                "note": "Audio category monitored",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InventoryMovementsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "movement_type": "out",
            
        
    
        
        
            
                "quantity": 200,
            
        
    
        
        
            
                "unit_cost": 8000,
            
        
    
        
        
            
                "reference_type": "purchase_order",
            
        
    
        
        
            
                "reference_number": "PO-2026-00021",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "moved_at": new Date('2026-06-01T05:10:00Z'),
            
        
    
        
        
            
                "note": "Inbound from supplier batch 21",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "movement_type": "in",
            
        
    
        
        
            
                "quantity": 20,
            
        
    
        
        
            
                "unit_cost": 35000,
            
        
    
        
        
            
                "reference_type": "order",
            
        
    
        
        
            
                "reference_number": "ORD-2026-01012",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "moved_at": new Date('2026-06-06T08:25:00Z'),
            
        
    
        
        
            
                "note": "Allocated for shipment",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "movement_type": "transfer_out",
            
        
    
        
        
            
                "quantity": -3,
            
        
    
        
        
            
                "unit_cost": 45000,
            
        
    
        
        
            
                "reference_type": "stock_opname",
            
        
    
        
        
            
                "reference_number": "SO-2026-00007",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "moved_at": new Date('2026-06-07T02:10:00Z'),
            
        
    
        
        
            
                "note": "Damaged packaging adjustment",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "movement_type": "out",
            
        
    
        
        
            
                "quantity": 15,
            
        
    
        
        
            
                "unit_cost": 220000,
            
        
    
        
        
            
                "reference_type": "transfer",
            
        
    
        
        
            
                "reference_number": "TRF-2026-00003",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "moved_at": new Date('2026-06-08T01:30:00Z'),
            
        
    
        
        
            
                "note": "Transfer to Bali depot",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CustomersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "customer_name": "Andi Setiawan",
            
        
    
        
        
            
                "email": "andi.setiawan@gmail.com",
            
        
    
        
        
            
                "phone_number": "+6281112340001",
            
        
    
        
        
            
                "address": "Jl. Melati No. 14",
            
        
    
        
        
            
                "city": "Jakarta",
            
        
    
        
        
            
                "province": "DKI Jakarta",
            
        
    
        
        
            
                "postal_code": "11730",
            
        
    
        
        
            
                "notes": "Prefers delivery on weekdays",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "customer_name": "Nabila Putri",
            
        
    
        
        
            
                "email": "nabilaputri@gmail.com",
            
        
    
        
        
            
                "phone_number": "+6281112340002",
            
        
    
        
        
            
                "address": "Jl. Kenanga No. 2",
            
        
    
        
        
            
                "city": "Bandung",
            
        
    
        
        
            
                "province": "Jawa Barat",
            
        
    
        
        
            
                "postal_code": "40286",
            
        
    
        
        
            
                "notes": "First-time buyer from promo",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "customer_name": "Yusuf Maulana",
            
        
    
        
        
            
                "email": "yusuf.maulana@gmail.com",
            
        
    
        
        
            
                "phone_number": "+6281112340003",
            
        
    
        
        
            
                "address": "Jl. Anggrek No. 9",
            
        
    
        
        
            
                "city": "Surabaya",
            
        
    
        
        
            
                "province": "Jawa Timur",
            
        
    
        
        
            
                "postal_code": "60241",
            
        
    
        
        
            
                "notes": "COD requested",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "customer_name": "Dewi Kartika",
            
        
    
        
        
            
                "email": "dewi.kartika@gmail.com",
            
        
    
        
        
            
                "phone_number": "+6281112340004",
            
        
    
        
        
            
                "address": "Jl. Mawar No. 7",
            
        
    
        
        
            
                "city": "Medan",
            
        
    
        
        
            
                "province": "Sumatera Utara",
            
        
    
        
        
            
                "postal_code": "20123",
            
        
    
        
        
            
                "notes": "Gift wrap note in chat",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const OrdersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_number": "ORD-2026-01012",
            
        
    
        
        
            
                "order_channel": "api",
            
        
    
        
        
            
                "order_status": "packed",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "subtotal_amount": 150000,
            
        
    
        
        
            
                "discount_amount": 10000,
            
        
    
        
        
            
                "shipping_amount": 18000,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "total_amount": 158000,
            
        
    
        
        
            
                "payment_status": "partial",
            
        
    
        
        
            
                "fulfillment_status": "returned",
            
        
    
        
        
            
                "shipping_courier": "JNE",
            
        
    
        
        
            
                "shipping_service": "REG",
            
        
    
        
        
            
                "tracking_number": "JNE123450001",
            
        
    
        
        
            
                "ordered_at": new Date('2026-06-06T07:55:00Z'),
            
        
    
        
        
            
                "paid_at": new Date('2026-06-06T08:05:00Z'),
            
        
    
        
        
            
                "shipped_at": new Date('2026-06-07T03:10:00Z'),
            
        
    
        
        
            
                "delivered_at": new Date('2026-06-09T09:00:00Z'),
            
        
    
        
        
            
                "shipping_address": "Jl. Melati No. 14, Jakarta",
            
        
    
        
        
            
                "customer_note": "Please pack securely",
            
        
    
        
        
            
                "internal_note": "Priority packing",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_number": "ORD-2026-01013",
            
        
    
        
        
            
                "order_channel": "manual_import",
            
        
    
        
        
            
                "order_status": "packed",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "subtotal_amount": 79000,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "shipping_amount": 12000,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "total_amount": 91000,
            
        
    
        
        
            
                "payment_status": "refunded",
            
        
    
        
        
            
                "fulfillment_status": "partial",
            
        
    
        
        
            
                "shipping_courier": "SiCepat",
            
        
    
        
        
            
                "shipping_service": "BEST",
            
        
    
        
        
            
                "tracking_number": "SCP67890002",
            
        
    
        
        
            
                "ordered_at": new Date('2026-06-07T10:20:00Z'),
            
        
    
        
        
            
                "paid_at": new Date('2026-06-07T10:25:00Z'),
            
        
    
        
        
            
                "shipped_at": new Date('2026-06-08T04:00:00Z'),
            
        
    
        
        
            
                "delivered_at": new Date('2026-06-10T08:30:00Z'),
            
        
    
        
        
            
                "shipping_address": "Jl. Kenanga No. 2, Bandung",
            
        
    
        
        
            
                "customer_note": "Deliver after 5 PM",
            
        
    
        
        
            
                "internal_note": "Partial fulfillment due to stock split",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_number": "ORD-2026-01014",
            
        
    
        
        
            
                "order_channel": "affiliate_link",
            
        
    
        
        
            
                "order_status": "paid",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "subtotal_amount": 399000,
            
        
    
        
        
            
                "discount_amount": 20000,
            
        
    
        
        
            
                "shipping_amount": 15000,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "total_amount": 394000,
            
        
    
        
        
            
                "payment_status": "partial",
            
        
    
        
        
            
                "fulfillment_status": "returned",
            
        
    
        
        
            
                "shipping_courier": "AnterAja",
            
        
    
        
        
            
                "shipping_service": "REG",
            
        
    
        
        
            
                "tracking_number": "AA11223344",
            
        
    
        
        
            
                "ordered_at": new Date('2026-06-08T12:10:00Z'),
            
        
    
        
        
            
                "paid_at": new Date('2026-06-08T13:40:00Z'),
            
        
    
        
        
            
                "shipped_at": new Date('2026-06-09T05:15:00Z'),
            
        
    
        
        
            
                "delivered_at": new Date('2026-06-12T06:00:00Z'),
            
        
    
        
        
            
                "shipping_address": "Jl. Anggrek No. 9, Surabaya",
            
        
    
        
        
            
                "customer_note": "Call on arrival",
            
        
    
        
        
            
                "internal_note": "Awaiting payment confirmation",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "order_number": "ORD-2026-01015",
            
        
    
        
        
            
                "order_channel": "reseller_storefront",
            
        
    
        
        
            
                "order_status": "delivered",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "subtotal_amount": 85000,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "shipping_amount": 14000,
            
        
    
        
        
            
                "tax_amount": 0,
            
        
    
        
        
            
                "total_amount": 99000,
            
        
    
        
        
            
                "payment_status": "paid",
            
        
    
        
        
            
                "fulfillment_status": "partial",
            
        
    
        
        
            
                "shipping_courier": "JNT",
            
        
    
        
        
            
                "shipping_service": "EZ",
            
        
    
        
        
            
                "tracking_number": "JNT99001122",
            
        
    
        
        
            
                "ordered_at": new Date('2026-06-09T02:40:00Z'),
            
        
    
        
        
            
                "paid_at": new Date('2026-06-09T02:55:00Z'),
            
        
    
        
        
            
                "shipped_at": new Date('2026-06-09T07:10:00Z'),
            
        
    
        
        
            
                "delivered_at": new Date('2026-06-11T11:20:00Z'),
            
        
    
        
        
            
                "shipping_address": "Jl. Mawar No. 7, Medan",
            
        
    
        
        
            
                "customer_note": "No plastic bag",
            
        
    
        
        
            
                "internal_note": "Imported from spreadsheet",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const OrderItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "item_name": "Herbal Immunity Drink 250ml",
            
        
    
        
        
            
                "sku": "NUS-HID-250",
            
        
    
        
        
            
                "unit_price": 12500,
            
        
    
        
        
            
                "quantity": 10,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "line_total_amount": 125000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "item_name": "Bright Glow Serum 30ml",
            
        
    
        
        
            
                "sku": "CLB-BGS-30",
            
        
    
        
        
            
                "unit_price": 79000,
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "line_total_amount": 79000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "item_name": "Wireless Earbuds Pro",
            
        
    
        
        
            
                "sku": "GMD-WEP-01",
            
        
    
        
        
            
                "unit_price": 399000,
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "discount_amount": 20000,
            
        
    
        
        
            
                "line_total_amount": 379000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "item_name": "Kopi Arabica Gayo 200g",
            
        
    
        
        
            
                "sku": "KOP-ARG-200",
            
        
    
        
        
            
                "unit_price": 85000,
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "discount_amount": 0,
            
        
    
        
        
            
                "line_total_amount": 85000,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InvoicesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "INV-2026-00051",
            
        
    
        
        
            
                "invoice_status": "draft",
            
        
    
        
        
            
                "issued_at": new Date('2026-06-06T08:06:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-06T23:59:00Z'),
            
        
    
        
        
            
                "amount_due": 158000,
            
        
    
        
        
            
                "amount_paid": 158000,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "billing_name": "Andi Setiawan",
            
        
    
        
        
            
                "billing_address": "Jl. Melati No. 14, Jakarta",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "INV-2026-00052",
            
        
    
        
        
            
                "invoice_status": "paid",
            
        
    
        
        
            
                "issued_at": new Date('2026-06-07T10:26:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-07T23:59:00Z'),
            
        
    
        
        
            
                "amount_due": 91000,
            
        
    
        
        
            
                "amount_paid": 91000,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "billing_name": "Nabila Putri",
            
        
    
        
        
            
                "billing_address": "Jl. Kenanga No. 2, Bandung",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "INV-2026-00053",
            
        
    
        
        
            
                "invoice_status": "void",
            
        
    
        
        
            
                "issued_at": new Date('2026-06-08T12:11:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-09T23:59:00Z'),
            
        
    
        
        
            
                "amount_due": 394000,
            
        
    
        
        
            
                "amount_paid": 0,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "billing_name": "Yusuf Maulana",
            
        
    
        
        
            
                "billing_address": "Jl. Anggrek No. 9, Surabaya",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "INV-2026-00054",
            
        
    
        
        
            
                "invoice_status": "refunded",
            
        
    
        
        
            
                "issued_at": new Date('2026-06-09T02:56:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-09T23:59:00Z'),
            
        
    
        
        
            
                "amount_due": 99000,
            
        
    
        
        
            
                "amount_paid": 99000,
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "billing_name": "Dewi Kartika",
            
        
    
        
        
            
                "billing_address": "Jl. Mawar No. 7, Medan",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PaymentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_reference": "PAY-2026-10021",
            
        
    
        
        
            
                "payment_method": "virtual_account",
            
        
    
        
        
            
                "payment_status": "pending",
            
        
    
        
        
            
                "amount": 158000,
            
        
    
        
        
            
                "paid_at": new Date('2026-06-06T08:05:30Z'),
            
        
    
        
        
            
                "payer_name": "Andi Setiawan",
            
        
    
        
        
            
                "note": "Transfer via mobile banking",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_reference": "PAY-2026-10022",
            
        
    
        
        
            
                "payment_method": "cash",
            
        
    
        
        
            
                "payment_status": "failed",
            
        
    
        
        
            
                "amount": 91000,
            
        
    
        
        
            
                "paid_at": new Date('2026-06-07T10:25:40Z'),
            
        
    
        
        
            
                "payer_name": "Nabila Putri",
            
        
    
        
        
            
                "note": "VA payment confirmed",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_reference": "PAY-2026-10023",
            
        
    
        
        
            
                "payment_method": "cod",
            
        
    
        
        
            
                "payment_status": "failed",
            
        
    
        
        
            
                "amount": 394000,
            
        
    
        
        
            
                "paid_at": new Date('2026-06-08T13:40:20Z'),
            
        
    
        
        
            
                "payer_name": "Yusuf Maulana",
            
        
    
        
        
            
                "note": "Gateway pending capture",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payment_reference": "PAY-2026-10024",
            
        
    
        
        
            
                "payment_method": "payment_gateway",
            
        
    
        
        
            
                "payment_status": "refunded",
            
        
    
        
        
            
                "amount": 99000,
            
        
    
        
        
            
                "paid_at": new Date('2026-06-11T11:21:00Z'),
            
        
    
        
        
            
                "payer_name": "Dewi Kartika",
            
        
    
        
        
            
                "note": "COD settled at delivery",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CommissionPlansData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "plan_name": "Default Reseller Plan 2026",
            
        
    
        
        
            
                "plan_status": "active",
            
        
    
        
        
            
                "calculation_base": "order_total",
            
        
    
        
        
            
                "commission_type": "fixed_amount",
            
        
    
        
        
            
                "default_rate": 5,
            
        
    
        
        
            
                "default_amount": 0,
            
        
    
        
        
            
                "include_shipping": true,
            
        
    
        
        
            
                "include_tax": true,
            
        
    
        
        
            
                "effective_from": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T23:59:00Z'),
            
        
    
        
        
            
                "notes": "Standard plan for reseller network",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "plan_name": "Agent Booster Plan Q2",
            
        
    
        
        
            
                "plan_status": "inactive",
            
        
    
        
        
            
                "calculation_base": "profit_estimate",
            
        
    
        
        
            
                "commission_type": "percentage",
            
        
    
        
        
            
                "default_rate": 7.5,
            
        
    
        
        
            
                "default_amount": 0,
            
        
    
        
        
            
                "include_shipping": true,
            
        
    
        
        
            
                "include_tax": false,
            
        
    
        
        
            
                "effective_from": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-06-30T23:59:00Z'),
            
        
    
        
        
            
                "notes": "Seasonal boost for agents",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "plan_name": "Distributor Fixed Fee Plan",
            
        
    
        
        
            
                "plan_status": "active",
            
        
    
        
        
            
                "calculation_base": "line_item_total",
            
        
    
        
        
            
                "commission_type": "percentage",
            
        
    
        
        
            
                "default_rate": 0,
            
        
    
        
        
            
                "default_amount": 2000,
            
        
    
        
        
            
                "include_shipping": false,
            
        
    
        
        
            
                "include_tax": false,
            
        
    
        
        
            
                "effective_from": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T23:59:00Z'),
            
        
    
        
        
            
                "notes": "Per item handling incentive",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "plan_name": "Affiliate Referral Plan",
            
        
    
        
        
            
                "plan_status": "active",
            
        
    
        
        
            
                "calculation_base": "profit_estimate",
            
        
    
        
        
            
                "commission_type": "fixed_amount",
            
        
    
        
        
            
                "default_rate": 3,
            
        
    
        
        
            
                "default_amount": 0,
            
        
    
        
        
            
                "include_shipping": true,
            
        
    
        
        
            
                "include_tax": false,
            
        
    
        
        
            
                "effective_from": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "effective_to": new Date('2026-12-31T23:59:00Z'),
            
        
    
        
        
            
                "notes": "Referral-driven commissions",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CommissionRulesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "applies_to_role": "distributor",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "commission_type": "percentage",
            
        
    
        
        
            
                "rate": 5,
            
        
    
        
        
            
                "amount": 0,
            
        
    
        
        
            
                "min_order_amount": 50000,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "rule_name": "Reseller baseline 5 percent",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "applies_to_role": "distributor",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "commission_type": "percentage",
            
        
    
        
        
            
                "rate": 7.5,
            
        
    
        
        
            
                "amount": 0,
            
        
    
        
        
            
                "min_order_amount": 100000,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "rule_name": "Agent booster 7.5 percent",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "applies_to_role": "distributor",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "commission_type": "percentage",
            
        
    
        
        
            
                "rate": 0,
            
        
    
        
        
            
                "amount": 2000,
            
        
    
        
        
            
                "min_order_amount": 0,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "rule_name": "Distributor fixed 2000 per line",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "applies_to_role": "master_distributor",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "commission_type": "percentage",
            
        
    
        
        
            
                "rate": 2,
            
        
    
        
        
            
                "amount": 0,
            
        
    
        
        
            
                "min_order_amount": 200000,
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "rule_name": "Master distributor override 2 percent",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CommissionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "commission_code": "COM-2026-90001",
            
        
    
        
        
            
                "commission_status": "reversed",
            
        
    
        
        
            
                "commission_type": "adjustment",
            
        
    
        
        
            
                "base_amount": 150000,
            
        
    
        
        
            
                "commission_amount": 7500,
            
        
    
        
        
            
                "earned_at": new Date('2026-06-06T08:06:30Z'),
            
        
    
        
        
            
                "approved_at": new Date('2026-06-07T01:00:00Z'),
            
        
    
        
        
            
                "paid_at": new Date('2026-06-15T02:00:00Z'),
            
        
    
        
        
            
                "notes": "Reseller commission for order ORD-2026-01012",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "commission_code": "COM-2026-90002",
            
        
    
        
        
            
                "commission_status": "paid",
            
        
    
        
        
            
                "commission_type": "referral",
            
        
    
        
        
            
                "base_amount": 79000,
            
        
    
        
        
            
                "commission_amount": 5925,
            
        
    
        
        
            
                "earned_at": new Date('2026-06-07T10:26:10Z'),
            
        
    
        
        
            
                "approved_at": new Date('2026-06-08T01:00:00Z'),
            
        
    
        
        
            
                "paid_at": new Date('2026-06-16T02:00:00Z'),
            
        
    
        
        
            
                "notes": "Agent commission for order ORD-2026-01013",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "commission_code": "COM-2026-90003",
            
        
    
        
        
            
                "commission_status": "cancelled",
            
        
    
        
        
            
                "commission_type": "referral",
            
        
    
        
        
            
                "base_amount": 394000,
            
        
    
        
        
            
                "commission_amount": 11820,
            
        
    
        
        
            
                "earned_at": new Date('2026-06-08T13:41:00Z'),
            
        
    
        
        
            
                "approved_at": new Date('2026-06-09T01:10:00Z'),
            
        
    
        
        
            
                "paid_at": new Date('2026-06-17T02:00:00Z'),
            
        
    
        
        
            
                "notes": "Referral commission from affiliate link",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "commission_code": "COM-2026-90004",
            
        
    
        
        
            
                "commission_status": "approved",
            
        
    
        
        
            
                "commission_type": "referral",
            
        
    
        
        
            
                "base_amount": 85000,
            
        
    
        
        
            
                "commission_amount": 4250,
            
        
    
        
        
            
                "earned_at": new Date('2026-06-09T02:56:40Z'),
            
        
    
        
        
            
                "approved_at": new Date('2026-06-10T01:00:00Z'),
            
        
    
        
        
            
                "paid_at": new Date('2026-06-12T02:00:00Z'),
            
        
    
        
        
            
                "notes": "Reseller commission for imported order",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PayoutsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payout_reference": "POUT-2026-00011",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payout_method": "ewallet",
            
        
    
        
        
            
                "payout_status": "scheduled",
            
        
    
        
        
            
                "gross_amount": 12000,
            
        
    
        
        
            
                "fee_amount": 2500,
            
        
    
        
        
            
                "net_amount": 9500,
            
        
    
        
        
            
                "scheduled_at": new Date('2026-06-15T01:00:00Z'),
            
        
    
        
        
            
                "processed_at": new Date('2026-06-15T01:30:00Z'),
            
        
    
        
        
            
                "paid_at": new Date('2026-06-15T02:05:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "note": "Weekly commission payout",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payout_reference": "POUT-2026-00012",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payout_method": "bank_transfer",
            
        
    
        
        
            
                "payout_status": "scheduled",
            
        
    
        
        
            
                "gross_amount": 6000,
            
        
    
        
        
            
                "fee_amount": 500,
            
        
    
        
        
            
                "net_amount": 5500,
            
        
    
        
        
            
                "scheduled_at": new Date('2026-06-16T01:00:00Z'),
            
        
    
        
        
            
                "processed_at": new Date('2026-06-16T01:20:00Z'),
            
        
    
        
        
            
                "paid_at": new Date('2026-06-16T02:10:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "note": "Ewallet payout batch A",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payout_reference": "POUT-2026-00013",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payout_method": "bank_transfer",
            
        
    
        
        
            
                "payout_status": "paid",
            
        
    
        
        
            
                "gross_amount": 15000,
            
        
    
        
        
            
                "fee_amount": 2500,
            
        
    
        
        
            
                "net_amount": 12500,
            
        
    
        
        
            
                "scheduled_at": new Date('2026-06-17T01:00:00Z'),
            
        
    
        
        
            
                "processed_at": new Date('2026-06-17T01:30:00Z'),
            
        
    
        
        
            
                "paid_at": new Date('2026-06-17T02:05:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "note": "Scheduled for high performer",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payout_reference": "POUT-2026-00014",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "payout_method": "cash",
            
        
    
        
        
            
                "payout_status": "scheduled",
            
        
    
        
        
            
                "gross_amount": 4000,
            
        
    
        
        
            
                "fee_amount": 0,
            
        
    
        
        
            
                "net_amount": 4000,
            
        
    
        
        
            
                "scheduled_at": new Date('2026-06-18T01:00:00Z'),
            
        
    
        
        
            
                "processed_at": new Date('2026-06-18T01:15:00Z'),
            
        
    
        
        
            
                "paid_at": new Date('2026-06-18T02:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "note": "Failed due to verification mismatch",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const BonusProgramsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "program_name": "June Revenue Sprint",
            
        
    
        
        
            
                "program_status": "active",
            
        
    
        
        
            
                "target_metric": "orders_count",
            
        
    
        
        
            
                "target_value": 5000000,
            
        
    
        
        
            
                "reward_type": "percentage",
            
        
    
        
        
            
                "reward_rate": 1.5,
            
        
    
        
        
            
                "reward_amount": 0,
            
        
    
        
        
            
                "gift_description": "Voucher belanja",
            
        
    
        
        
            
                "starts_at": new Date('2026-06-01T00:00:00Z'),
            
        
    
        
        
            
                "ends_at": new Date('2026-06-30T23:59:00Z'),
            
        
    
        
        
            
                "terms": "Bonus berlaku untuk reseller aktif dengan transaksi valid.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "program_name": "Top Seller Reward Q2",
            
        
    
        
        
            
                "program_status": "inactive",
            
        
    
        
        
            
                "target_metric": "profit_estimate",
            
        
    
        
        
            
                "target_value": 50,
            
        
    
        
        
            
                "reward_type": "percentage",
            
        
    
        
        
            
                "reward_rate": 0,
            
        
    
        
        
            
                "reward_amount": 250000,
            
        
    
        
        
            
                "gift_description": "Merch pack",
            
        
    
        
        
            
                "starts_at": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "ends_at": new Date('2026-06-30T23:59:00Z'),
            
        
    
        
        
            
                "terms": "Penilaian berdasarkan order delivered tanpa refund.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "program_name": "Distributor Volume Drive",
            
        
    
        
        
            
                "program_status": "draft",
            
        
    
        
        
            
                "target_metric": "profit_estimate",
            
        
    
        
        
            
                "target_value": 500,
            
        
    
        
        
            
                "reward_type": "gift",
            
        
    
        
        
            
                "reward_rate": 0,
            
        
    
        
        
            
                "reward_amount": 500000,
            
        
    
        
        
            
                "gift_description": "Paket promosi",
            
        
    
        
        
            
                "starts_at": new Date('2026-05-15T00:00:00Z'),
            
        
    
        
        
            
                "ends_at": new Date('2026-07-15T23:59:00Z'),
            
        
    
        
        
            
                "terms": "Target dihitung untuk item kategori tertentu.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "program_name": "Profit Champion",
            
        
    
        
        
            
                "program_status": "draft",
            
        
    
        
        
            
                "target_metric": "units_sold",
            
        
    
        
        
            
                "target_value": 2000000,
            
        
    
        
        
            
                "reward_type": "percentage",
            
        
    
        
        
            
                "reward_rate": 0,
            
        
    
        
        
            
                "reward_amount": 0,
            
        
    
        
        
            
                "gift_description": "Smartphone mid-range",
            
        
    
        
        
            
                "starts_at": new Date('2026-07-01T00:00:00Z'),
            
        
    
        
        
            
                "ends_at": new Date('2026-07-31T23:59:00Z'),
            
        
    
        
        
            
                "terms": "Program draft menunggu persetujuan manajemen.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ReferralLinksData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "link_name": "Maya Storefront Link",
            
        
    
        
        
            
                "code": "MAYA-STORE-01",
            
        
    
        
        
            
                "destination_url": "https://vorta-demo.id/r/maya-store",
            
        
    
        
        
            
                "link_type": "landing_page",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "starts_at": new Date('2026-06-01T00:00:00Z'),
            
        
    
        
        
            
                "ends_at": new Date('2026-12-31T23:59:00Z'),
            
        
    
        
        
            
                "click_count": 320,
            
        
    
        
        
            
                "conversion_count": 18,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "link_name": "Serum Campaign Link",
            
        
    
        
        
            
                "code": "SERUM-JUN-26",
            
        
    
        
        
            
                "destination_url": "https://cantiklokal.co.id/r/serum-jun",
            
        
    
        
        
            
                "link_type": "product",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "starts_at": new Date('2026-06-05T00:00:00Z'),
            
        
    
        
        
            
                "ends_at": new Date('2026-06-30T23:59:00Z'),
            
        
    
        
        
            
                "click_count": 540,
            
        
    
        
        
            
                "conversion_count": 22,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "link_name": "Earbuds Product Link",
            
        
    
        
        
            
                "code": "EARBUDS-PRO-01",
            
        
    
        
        
            
                "destination_url": "https://gadgetmart.id/r/earbuds-pro",
            
        
    
        
        
            
                "link_type": "campaign",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "starts_at": new Date('2026-05-01T00:00:00Z'),
            
        
    
        
        
            
                "ends_at": new Date('2026-12-31T23:59:00Z'),
            
        
    
        
        
            
                "click_count": 210,
            
        
    
        
        
            
                "conversion_count": 9,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "link_name": "Herbal Landing Page",
            
        
    
        
        
            
                "code": "HERBAL-LP-01",
            
        
    
        
        
            
                "destination_url": "https://nusantara-herbal.id/r/herbal-lp",
            
        
    
        
        
            
                "link_type": "product",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "starts_at": new Date('2026-06-01T00:00:00Z'),
            
        
    
        
        
            
                "ends_at": new Date('2026-08-31T23:59:00Z'),
            
        
    
        
        
            
                "click_count": 430,
            
        
    
        
        
            
                "conversion_count": 27,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ResellerStoresData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "store_name": "Maya Cantik Store",
            
        
    
        
        
            
                "slug": "maya-cantik",
            
        
    
        
        
            
                "store_status": "draft",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "tagline": "Skincare pilihan harga reseller",
            
        
    
        
        
            
                "about": "Toko reseller skincare dan beauty products dengan pelayanan cepat.",
            
        
    
        
        
            
                "whatsapp_number": "+6281312345678",
            
        
    
        
        
            
                "instagram_handle": "maya.cantikstore",
            
        
    
        
        
            
                "tiktok_handle": "maya.cantikstore",
            
        
    
        
        
            
                "custom_domain": "maya-cantik.id",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "store_name": "Agus Distribusi Hub",
            
        
    
        
        
            
                "slug": "agus-distribusi",
            
        
    
        
        
            
                "store_status": "suspended",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "tagline": "Distribusi cepat untuk area Jawa Barat",
            
        
    
        
        
            
                "about": "Melayanai pembelian grosir untuk agen dan reseller area Bandung dan sekitarnya.",
            
        
    
        
        
            
                "whatsapp_number": "+6281298765432",
            
        
    
        
        
            
                "instagram_handle": "agus.distribusi",
            
        
    
        
        
            
                "tiktok_handle": "agusdistribusi",
            
        
    
        
        
            
                "custom_domain": "agus-distribusi.id",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "store_name": "Raka Official Store",
            
        
    
        
        
            
                "slug": "raka-store",
            
        
    
        
        
            
                "store_status": "suspended",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "tagline": "Produk pilihan untuk jaringan reseller",
            
        
    
        
        
            
                "about": "Official storefront untuk produk demo VORTA dan katalog unggulan.",
            
        
    
        
        
            
                "whatsapp_number": "+6281210001000",
            
        
    
        
        
            
                "instagram_handle": "raka.officialstore",
            
        
    
        
        
            
                "tiktok_handle": "raka.officialstore",
            
        
    
        
        
            
                "custom_domain": "raka-store.id",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "store_name": "Dimas Sales Page",
            
        
    
        
        
            
                "slug": "dimas-sales",
            
        
    
        
        
            
                "store_status": "published",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "tagline": "Promo mingguan dan rekomendasi produk",
            
        
    
        
        
            
                "about": "Katalog untuk pelanggan dan reseller baru. Sedang disiapkan.",
            
        
    
        
        
            
                "whatsapp_number": "+6281210003000",
            
        
    
        
        
            
                "instagram_handle": "dimas.sales",
            
        
    
        
        
            
                "tiktok_handle": "dimassales",
            
        
    
        
        
            
                "custom_domain": "dimas-sales.id",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const StorePagesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "page_title": "Promo Juni",
            
        
    
        
        
            
                "slug": "promo-juni",
            
        
    
        
        
            
                "page_type": "faq",
            
        
    
        
        
            
                "page_status": "archived",
            
        
    
        
        
            
                "content": "Promo spesial Juni untuk produk pilihan. Stok terbatas.",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "page_title": "Katalog Produk",
            
        
    
        
        
            
                "slug": "katalog",
            
        
    
        
        
            
                "page_type": "custom",
            
        
    
        
        
            
                "page_status": "draft",
            
        
    
        
        
            
                "content": "Daftar produk terbaru dan best seller untuk pelanggan.",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "page_title": "FAQ Pengiriman",
            
        
    
        
        
            
                "slug": "faq-pengiriman",
            
        
    
        
        
            
                "page_type": "landing",
            
        
    
        
        
            
                "page_status": "archived",
            
        
    
        
        
            
                "content": "Informasi estimasi pengiriman dan opsi kurir yang tersedia.",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "page_title": "Kebijakan Retur",
            
        
    
        
        
            
                "slug": "kebijakan-retur",
            
        
    
        
        
            
                "page_type": "product_list",
            
        
    
        
        
            
                "page_status": "archived",
            
        
    
        
        
            
                "content": "Retur diterima sesuai ketentuan dan kondisi barang.",
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const NotificationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notification_type": "ai_insight",
            
        
    
        
        
            
                "channel": "sms",
            
        
    
        
        
            
                "title_text": "Low stock alert",
            
        
    
        
        
            
                "message_text": "Stock for Bright Glow Serum is below threshold at Bandung hub.",
            
        
    
        
        
            
                "action_url": "/inventory",
            
        
    
        
        
            
                "is_read": true,
            
        
    
        
        
            
                "sent_at": new Date('2026-06-12T02:00:00Z'),
            
        
    
        
        
            
                "read_at": new Date('2026-06-12T03:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notification_type": "low_stock",
            
        
    
        
        
            
                "channel": "email",
            
        
    
        
        
            
                "title_text": "Order shipped",
            
        
    
        
        
            
                "message_text": "Order ORD-2026-01015 has been shipped with JNT.",
            
        
    
        
        
            
                "action_url": "/orders/ORD-2026-01015",
            
        
    
        
        
            
                "is_read": true,
            
        
    
        
        
            
                "sent_at": new Date('2026-06-09T07:15:00Z'),
            
        
    
        
        
            
                "read_at": new Date('2026-06-09T08:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notification_type": "ai_insight",
            
        
    
        
        
            
                "channel": "email",
            
        
    
        
        
            
                "title_text": "Commission approved",
            
        
    
        
        
            
                "message_text": "Commission COM-2026-90001 is approved and scheduled for payout.",
            
        
    
        
        
            
                "action_url": "/commissions",
            
        
    
        
        
            
                "is_read": false,
            
        
    
        
        
            
                "sent_at": new Date('2026-06-07T01:05:00Z'),
            
        
    
        
        
            
                "read_at": new Date('2026-06-07T02:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "notification_type": "payout_update",
            
        
    
        
        
            
                "channel": "in_app",
            
        
    
        
        
            
                "title_text": "Payout completed",
            
        
    
        
        
            
                "message_text": "Payout POUT-2026-00011 has been paid to your bank account.",
            
        
    
        
        
            
                "action_url": "/payouts/POUT-2026-00011",
            
        
    
        
        
            
                "is_read": true,
            
        
    
        
        
            
                "sent_at": new Date('2026-06-15T02:06:00Z'),
            
        
    
        
        
            
                "read_at": new Date('2026-06-15T02:20:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const AiInsightsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "insight_type": "market_opportunity",
            
        
    
        
        
            
                "severity": "info",
            
        
    
        
        
            
                "insight_title": "Herbal drink demand increasing",
            
        
    
        
        
            
                "insight_summary": "Forecast shows 18 percent increase in weekly demand driven by referral traffic.",
            
        
    
        
        
            
                "recommendation": "Increase replenishment to Jakarta warehouse and activate June campaign link.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "generated_at": new Date('2026-06-14T00:00:00Z'),
            
        
    
        
        
            
                "valid_until": new Date('2026-06-21T00:00:00Z'),
            
        
    
        
        
            
                "is_acknowledged": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "insight_type": "strategy_recommendation",
            
        
    
        
        
            
                "severity": "critical",
            
        
    
        
        
            
                "insight_title": "Serum stock risk at Bandung hub",
            
        
    
        
        
            
                "insight_summary": "Projected stockout in 6 days based on recent order velocity.",
            
        
    
        
        
            
                "recommendation": "Transfer 30 units from Jakarta main warehouse to Bandung hub.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "generated_at": new Date('2026-06-13T00:00:00Z'),
            
        
    
        
        
            
                "valid_until": new Date('2026-06-20T00:00:00Z'),
            
        
    
        
        
            
                "is_acknowledged": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "insight_type": "performance_drop",
            
        
    
        
        
            
                "severity": "critical",
            
        
    
        
        
            
                "insight_title": "Reseller engagement declining",
            
        
    
        
        
            
                "insight_summary": "Conversion rate dropped for one storefront compared to last month.",
            
        
    
        
        
            
                "recommendation": "Send targeted promo and refresh storefront landing page content.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "generated_at": new Date('2026-06-12T00:00:00Z'),
            
        
    
        
        
            
                "valid_until": new Date('2026-06-19T00:00:00Z'),
            
        
    
        
        
            
                "is_acknowledged": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "insight_type": "sales_forecast",
            
        
    
        
        
            
                "severity": "critical",
            
        
    
        
        
            
                "insight_title": "Top reseller identified",
            
        
    
        
        
            
                "insight_summary": "One reseller accounts for 24 percent of June revenue in the skincare category.",
            
        
    
        
        
            
                "recommendation": "Offer tiered commission and provide new product samples.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "generated_at": new Date('2026-06-11T00:00:00Z'),
            
        
    
        
        
            
                "valid_until": new Date('2026-06-18T00:00:00Z'),
            
        
    
        
        
            
                "is_acknowledged": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SalesTargetsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "target_name": "June Company Revenue Target",
            
        
    
        
        
            
                "target_scope": "company",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "metric": "units_sold",
            
        
    
        
        
            
                "target_value": 25000000,
            
        
    
        
        
            
                "achieved_value": 12850000,
            
        
    
        
        
            
                "period_start": new Date('2026-06-01T00:00:00Z'),
            
        
    
        
        
            
                "period_end": new Date('2026-06-30T23:59:00Z'),
            
        
    
        
        
            
                "status": "missed",
            
        
    
        
        
            
                "notes": "Company-wide target for June",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "target_name": "Maya June Orders Target",
            
        
    
        
        
            
                "target_scope": "team",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "metric": "new_resellers",
            
        
    
        
        
            
                "target_value": 40,
            
        
    
        
        
            
                "achieved_value": 22,
            
        
    
        
        
            
                "period_start": new Date('2026-06-01T00:00:00Z'),
            
        
    
        
        
            
                "period_end": new Date('2026-06-30T23:59:00Z'),
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "notes": "Focus on skincare upsell",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "target_name": "Recruit New Resellers Q2",
            
        
    
        
        
            
                "target_scope": "user",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "metric": "new_resellers",
            
        
    
        
        
            
                "target_value": 30,
            
        
    
        
        
            
                "achieved_value": 18,
            
        
    
        
        
            
                "period_start": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "period_end": new Date('2026-06-30T23:59:00Z'),
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "notes": "Track onboarding and first order",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "target_name": "Distributor Units Sold Drive",
            
        
    
        
        
            
                "target_scope": "user",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "metric": "new_resellers",
            
        
    
        
        
            
                "target_value": 1200,
            
        
    
        
        
            
                "achieved_value": 640,
            
        
    
        
        
            
                "period_start": new Date('2026-05-15T00:00:00Z'),
            
        
    
        
        
            
                "period_end": new Date('2026-07-15T23:59:00Z'),
            
        
    
        
        
            
                "status": "achieved",
            
        
    
        
        
            
                "notes": "Category mix monitored weekly",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateUserWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User0 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (User0?.setOrganization)
                {
                    await
                    User0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User1 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (User1?.setOrganization)
                {
                    await
                    User1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User2 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (User2?.setOrganization)
                {
                    await
                    User2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const User3 = await Users.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (User3?.setOrganization)
                {
                    await
                    User3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
    
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateTenantWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Tenant0 = await Tenants.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Tenant0?.setOrganization)
                {
                    await
                    Tenant0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Tenant1 = await Tenants.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Tenant1?.setOrganization)
                {
                    await
                    Tenant1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Tenant2 = await Tenants.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Tenant2?.setOrganization)
                {
                    await
                    Tenant2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Tenant3 = await Tenants.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Tenant3?.setOrganization)
                {
                    await
                    Tenant3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateProductWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Product0 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Product0?.setTenant)
                {
                    await
                    Product0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Product1 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Product1?.setTenant)
                {
                    await
                    Product1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Product2 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Product2?.setTenant)
                {
                    await
                    Product2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Product3 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Product3?.setTenant)
                {
                    await
                    Product3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateProductWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Product0 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Product0?.setOrganization)
                {
                    await
                    Product0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Product1 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Product1?.setOrganization)
                {
                    await
                    Product1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Product2 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Product2?.setOrganization)
                {
                    await
                    Product2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Product3 = await Products.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Product3?.setOrganization)
                {
                    await
                    Product3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateWarehousWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Warehous0 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Warehous0?.setTenant)
                {
                    await
                    Warehous0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Warehous1 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Warehous1?.setTenant)
                {
                    await
                    Warehous1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Warehous2 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Warehous2?.setTenant)
                {
                    await
                    Warehous2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Warehous3 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Warehous3?.setTenant)
                {
                    await
                    Warehous3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateWarehousWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Warehous0 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Warehous0?.setOrganization)
                {
                    await
                    Warehous0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Warehous1 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Warehous1?.setOrganization)
                {
                    await
                    Warehous1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Warehous2 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Warehous2?.setOrganization)
                {
                    await
                    Warehous2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Warehous3 = await Warehouses.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Warehous3?.setOrganization)
                {
                    await
                    Warehous3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateInventoryItemWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const InventoryItem0 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryItem0?.setTenant)
                {
                    await
                    InventoryItem0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const InventoryItem1 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryItem1?.setTenant)
                {
                    await
                    InventoryItem1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const InventoryItem2 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryItem2?.setTenant)
                {
                    await
                    InventoryItem2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const InventoryItem3 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryItem3?.setTenant)
                {
                    await
                    InventoryItem3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
            
            async function associateInventoryItemWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryItem0 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryItem0?.setProduct)
                {
                    await
                    InventoryItem0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryItem1 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryItem1?.setProduct)
                {
                    await
                    InventoryItem1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryItem2 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryItem2?.setProduct)
                {
                    await
                    InventoryItem2.
                    setProduct(relatedProduct2);
                }
            
                const relatedProduct3 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryItem3 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryItem3?.setProduct)
                {
                    await
                    InventoryItem3.
                    setProduct(relatedProduct3);
                }
            
        }
        
    
        
            
            async function associateInventoryItemWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryItem0 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryItem0?.setWarehouse)
                {
                    await
                    InventoryItem0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryItem1 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryItem1?.setWarehouse)
                {
                    await
                    InventoryItem1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryItem2 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryItem2?.setWarehouse)
                {
                    await
                    InventoryItem2.
                    setWarehouse(relatedWarehouse2);
                }
            
                const relatedWarehouse3 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryItem3 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryItem3?.setWarehouse)
                {
                    await
                    InventoryItem3.
                    setWarehouse(relatedWarehouse3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInventoryItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryItem0 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryItem0?.setOrganization)
                {
                    await
                    InventoryItem0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryItem1 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryItem1?.setOrganization)
                {
                    await
                    InventoryItem1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryItem2 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryItem2?.setOrganization)
                {
                    await
                    InventoryItem2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryItem3 = await InventoryItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryItem3?.setOrganization)
                {
                    await
                    InventoryItem3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateInventoryMovementWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setTenant)
                {
                    await
                    InventoryMovement0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setTenant)
                {
                    await
                    InventoryMovement1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setTenant)
                {
                    await
                    InventoryMovement2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const InventoryMovement3 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryMovement3?.setTenant)
                {
                    await
                    InventoryMovement3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
            
            async function associateInventoryMovementWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setWarehouse)
                {
                    await
                    InventoryMovement0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setWarehouse)
                {
                    await
                    InventoryMovement1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setWarehouse)
                {
                    await
                    InventoryMovement2.
                    setWarehouse(relatedWarehouse2);
                }
            
                const relatedWarehouse3 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const InventoryMovement3 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryMovement3?.setWarehouse)
                {
                    await
                    InventoryMovement3.
                    setWarehouse(relatedWarehouse3);
                }
            
        }
        
    
        
            
            async function associateInventoryMovementWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setProduct)
                {
                    await
                    InventoryMovement0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setProduct)
                {
                    await
                    InventoryMovement1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setProduct)
                {
                    await
                    InventoryMovement2.
                    setProduct(relatedProduct2);
                }
            
                const relatedProduct3 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const InventoryMovement3 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryMovement3?.setProduct)
                {
                    await
                    InventoryMovement3.
                    setProduct(relatedProduct3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInventoryMovementWithPerformed_by() {
            
                const relatedPerformed_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setPerformed_by)
                {
                    await
                    InventoryMovement0.
                    setPerformed_by(relatedPerformed_by0);
                }
            
                const relatedPerformed_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setPerformed_by)
                {
                    await
                    InventoryMovement1.
                    setPerformed_by(relatedPerformed_by1);
                }
            
                const relatedPerformed_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setPerformed_by)
                {
                    await
                    InventoryMovement2.
                    setPerformed_by(relatedPerformed_by2);
                }
            
                const relatedPerformed_by3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const InventoryMovement3 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryMovement3?.setPerformed_by)
                {
                    await
                    InventoryMovement3.
                    setPerformed_by(relatedPerformed_by3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateInventoryMovementWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryMovement0 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InventoryMovement0?.setOrganization)
                {
                    await
                    InventoryMovement0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryMovement1 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InventoryMovement1?.setOrganization)
                {
                    await
                    InventoryMovement1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryMovement2 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InventoryMovement2?.setOrganization)
                {
                    await
                    InventoryMovement2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InventoryMovement3 = await InventoryMovements.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (InventoryMovement3?.setOrganization)
                {
                    await
                    InventoryMovement3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCustomerWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Customer0 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Customer0?.setTenant)
                {
                    await
                    Customer0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Customer1 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Customer1?.setTenant)
                {
                    await
                    Customer1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Customer2 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Customer2?.setTenant)
                {
                    await
                    Customer2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Customer3 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Customer3?.setTenant)
                {
                    await
                    Customer3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCustomerWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Customer0 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Customer0?.setOrganization)
                {
                    await
                    Customer0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Customer1 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Customer1?.setOrganization)
                {
                    await
                    Customer1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Customer2 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Customer2?.setOrganization)
                {
                    await
                    Customer2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Customer3 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Customer3?.setOrganization)
                {
                    await
                    Customer3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateOrderWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Order0 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Order0?.setTenant)
                {
                    await
                    Order0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Order1 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Order1?.setTenant)
                {
                    await
                    Order1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Order2 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Order2?.setTenant)
                {
                    await
                    Order2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Order3 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Order3?.setTenant)
                {
                    await
                    Order3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateOrderWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Order0 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Order0?.setCustomer)
                {
                    await
                    Order0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Order1 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Order1?.setCustomer)
                {
                    await
                    Order1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Order2 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Order2?.setCustomer)
                {
                    await
                    Order2.
                    setCustomer(relatedCustomer2);
                }
            
                const relatedCustomer3 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Order3 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Order3?.setCustomer)
                {
                    await
                    Order3.
                    setCustomer(relatedCustomer3);
                }
            
        }
        
    
        
            
            async function associateOrderWithSeller_user() {
            
                const relatedSeller_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Order0 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Order0?.setSeller_user)
                {
                    await
                    Order0.
                    setSeller_user(relatedSeller_user0);
                }
            
                const relatedSeller_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Order1 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Order1?.setSeller_user)
                {
                    await
                    Order1.
                    setSeller_user(relatedSeller_user1);
                }
            
                const relatedSeller_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Order2 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Order2?.setSeller_user)
                {
                    await
                    Order2.
                    setSeller_user(relatedSeller_user2);
                }
            
                const relatedSeller_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Order3 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Order3?.setSeller_user)
                {
                    await
                    Order3.
                    setSeller_user(relatedSeller_user3);
                }
            
        }
        
    
        
            
            async function associateOrderWithWarehouse() {
            
                const relatedWarehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const Order0 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Order0?.setWarehouse)
                {
                    await
                    Order0.
                    setWarehouse(relatedWarehouse0);
                }
            
                const relatedWarehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const Order1 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Order1?.setWarehouse)
                {
                    await
                    Order1.
                    setWarehouse(relatedWarehouse1);
                }
            
                const relatedWarehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const Order2 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Order2?.setWarehouse)
                {
                    await
                    Order2.
                    setWarehouse(relatedWarehouse2);
                }
            
                const relatedWarehouse3 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const Order3 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Order3?.setWarehouse)
                {
                    await
                    Order3.
                    setWarehouse(relatedWarehouse3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateOrderWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Order0 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Order0?.setOrganization)
                {
                    await
                    Order0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Order1 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Order1?.setOrganization)
                {
                    await
                    Order1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Order2 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Order2?.setOrganization)
                {
                    await
                    Order2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Order3 = await Orders.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Order3?.setOrganization)
                {
                    await
                    Order3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateOrderItemWithOrder() {
            
                const relatedOrder0 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const OrderItem0 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (OrderItem0?.setOrder)
                {
                    await
                    OrderItem0.
                    setOrder(relatedOrder0);
                }
            
                const relatedOrder1 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const OrderItem1 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (OrderItem1?.setOrder)
                {
                    await
                    OrderItem1.
                    setOrder(relatedOrder1);
                }
            
                const relatedOrder2 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const OrderItem2 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (OrderItem2?.setOrder)
                {
                    await
                    OrderItem2.
                    setOrder(relatedOrder2);
                }
            
                const relatedOrder3 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const OrderItem3 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (OrderItem3?.setOrder)
                {
                    await
                    OrderItem3.
                    setOrder(relatedOrder3);
                }
            
        }
        
    
        
            
            async function associateOrderItemWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const OrderItem0 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (OrderItem0?.setProduct)
                {
                    await
                    OrderItem0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const OrderItem1 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (OrderItem1?.setProduct)
                {
                    await
                    OrderItem1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const OrderItem2 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (OrderItem2?.setProduct)
                {
                    await
                    OrderItem2.
                    setProduct(relatedProduct2);
                }
            
                const relatedProduct3 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const OrderItem3 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (OrderItem3?.setProduct)
                {
                    await
                    OrderItem3.
                    setProduct(relatedProduct3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateOrderItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OrderItem0 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (OrderItem0?.setOrganization)
                {
                    await
                    OrderItem0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OrderItem1 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (OrderItem1?.setOrganization)
                {
                    await
                    OrderItem1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OrderItem2 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (OrderItem2?.setOrganization)
                {
                    await
                    OrderItem2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OrderItem3 = await OrderItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (OrderItem3?.setOrganization)
                {
                    await
                    OrderItem3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateInvoiceWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setTenant)
                {
                    await
                    Invoice0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setTenant)
                {
                    await
                    Invoice1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setTenant)
                {
                    await
                    Invoice2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Invoice3 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Invoice3?.setTenant)
                {
                    await
                    Invoice3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
            
            async function associateInvoiceWithOrder() {
            
                const relatedOrder0 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setOrder)
                {
                    await
                    Invoice0.
                    setOrder(relatedOrder0);
                }
            
                const relatedOrder1 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setOrder)
                {
                    await
                    Invoice1.
                    setOrder(relatedOrder1);
                }
            
                const relatedOrder2 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setOrder)
                {
                    await
                    Invoice2.
                    setOrder(relatedOrder2);
                }
            
                const relatedOrder3 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const Invoice3 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Invoice3?.setOrder)
                {
                    await
                    Invoice3.
                    setOrder(relatedOrder3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInvoiceWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setOrganization)
                {
                    await
                    Invoice0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setOrganization)
                {
                    await
                    Invoice1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setOrganization)
                {
                    await
                    Invoice2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Invoice3 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Invoice3?.setOrganization)
                {
                    await
                    Invoice3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePaymentWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setTenant)
                {
                    await
                    Payment0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setTenant)
                {
                    await
                    Payment1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setTenant)
                {
                    await
                    Payment2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Payment3 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Payment3?.setTenant)
                {
                    await
                    Payment3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
            
            async function associatePaymentWithOrder() {
            
                const relatedOrder0 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setOrder)
                {
                    await
                    Payment0.
                    setOrder(relatedOrder0);
                }
            
                const relatedOrder1 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setOrder)
                {
                    await
                    Payment1.
                    setOrder(relatedOrder1);
                }
            
                const relatedOrder2 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setOrder)
                {
                    await
                    Payment2.
                    setOrder(relatedOrder2);
                }
            
                const relatedOrder3 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const Payment3 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Payment3?.setOrder)
                {
                    await
                    Payment3.
                    setOrder(relatedOrder3);
                }
            
        }
        
    
        
            
            async function associatePaymentWithInvoice() {
            
                const relatedInvoice0 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setInvoice)
                {
                    await
                    Payment0.
                    setInvoice(relatedInvoice0);
                }
            
                const relatedInvoice1 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setInvoice)
                {
                    await
                    Payment1.
                    setInvoice(relatedInvoice1);
                }
            
                const relatedInvoice2 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setInvoice)
                {
                    await
                    Payment2.
                    setInvoice(relatedInvoice2);
                }
            
                const relatedInvoice3 = await Invoices.findOne({
                    offset: Math.floor(Math.random() * (await Invoices.count())),
                });
                const Payment3 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Payment3?.setInvoice)
                {
                    await
                    Payment3.
                    setInvoice(relatedInvoice3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePaymentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setOrganization)
                {
                    await
                    Payment0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setOrganization)
                {
                    await
                    Payment1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setOrganization)
                {
                    await
                    Payment2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment3 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Payment3?.setOrganization)
                {
                    await
                    Payment3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCommissionPlanWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const CommissionPlan0 = await CommissionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CommissionPlan0?.setTenant)
                {
                    await
                    CommissionPlan0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const CommissionPlan1 = await CommissionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CommissionPlan1?.setTenant)
                {
                    await
                    CommissionPlan1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const CommissionPlan2 = await CommissionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CommissionPlan2?.setTenant)
                {
                    await
                    CommissionPlan2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const CommissionPlan3 = await CommissionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CommissionPlan3?.setTenant)
                {
                    await
                    CommissionPlan3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCommissionPlanWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CommissionPlan0 = await CommissionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CommissionPlan0?.setOrganization)
                {
                    await
                    CommissionPlan0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CommissionPlan1 = await CommissionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CommissionPlan1?.setOrganization)
                {
                    await
                    CommissionPlan1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CommissionPlan2 = await CommissionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CommissionPlan2?.setOrganization)
                {
                    await
                    CommissionPlan2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CommissionPlan3 = await CommissionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CommissionPlan3?.setOrganization)
                {
                    await
                    CommissionPlan3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCommissionRuleWithCommission_plan() {
            
                const relatedCommission_plan0 = await CommissionPlans.findOne({
                    offset: Math.floor(Math.random() * (await CommissionPlans.count())),
                });
                const CommissionRule0 = await CommissionRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CommissionRule0?.setCommission_plan)
                {
                    await
                    CommissionRule0.
                    setCommission_plan(relatedCommission_plan0);
                }
            
                const relatedCommission_plan1 = await CommissionPlans.findOne({
                    offset: Math.floor(Math.random() * (await CommissionPlans.count())),
                });
                const CommissionRule1 = await CommissionRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CommissionRule1?.setCommission_plan)
                {
                    await
                    CommissionRule1.
                    setCommission_plan(relatedCommission_plan1);
                }
            
                const relatedCommission_plan2 = await CommissionPlans.findOne({
                    offset: Math.floor(Math.random() * (await CommissionPlans.count())),
                });
                const CommissionRule2 = await CommissionRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CommissionRule2?.setCommission_plan)
                {
                    await
                    CommissionRule2.
                    setCommission_plan(relatedCommission_plan2);
                }
            
                const relatedCommission_plan3 = await CommissionPlans.findOne({
                    offset: Math.floor(Math.random() * (await CommissionPlans.count())),
                });
                const CommissionRule3 = await CommissionRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CommissionRule3?.setCommission_plan)
                {
                    await
                    CommissionRule3.
                    setCommission_plan(relatedCommission_plan3);
                }
            
        }
        
    
        
    
        
            
            async function associateCommissionRuleWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const CommissionRule0 = await CommissionRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CommissionRule0?.setProduct)
                {
                    await
                    CommissionRule0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const CommissionRule1 = await CommissionRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CommissionRule1?.setProduct)
                {
                    await
                    CommissionRule1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const CommissionRule2 = await CommissionRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CommissionRule2?.setProduct)
                {
                    await
                    CommissionRule2.
                    setProduct(relatedProduct2);
                }
            
                const relatedProduct3 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const CommissionRule3 = await CommissionRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CommissionRule3?.setProduct)
                {
                    await
                    CommissionRule3.
                    setProduct(relatedProduct3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCommissionRuleWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CommissionRule0 = await CommissionRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CommissionRule0?.setOrganization)
                {
                    await
                    CommissionRule0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CommissionRule1 = await CommissionRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CommissionRule1?.setOrganization)
                {
                    await
                    CommissionRule1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CommissionRule2 = await CommissionRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CommissionRule2?.setOrganization)
                {
                    await
                    CommissionRule2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CommissionRule3 = await CommissionRules.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (CommissionRule3?.setOrganization)
                {
                    await
                    CommissionRule3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCommissionWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Commission0 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Commission0?.setTenant)
                {
                    await
                    Commission0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Commission1 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Commission1?.setTenant)
                {
                    await
                    Commission1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Commission2 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Commission2?.setTenant)
                {
                    await
                    Commission2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Commission3 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Commission3?.setTenant)
                {
                    await
                    Commission3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
            
            async function associateCommissionWithOrder() {
            
                const relatedOrder0 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const Commission0 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Commission0?.setOrder)
                {
                    await
                    Commission0.
                    setOrder(relatedOrder0);
                }
            
                const relatedOrder1 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const Commission1 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Commission1?.setOrder)
                {
                    await
                    Commission1.
                    setOrder(relatedOrder1);
                }
            
                const relatedOrder2 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const Commission2 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Commission2?.setOrder)
                {
                    await
                    Commission2.
                    setOrder(relatedOrder2);
                }
            
                const relatedOrder3 = await Orders.findOne({
                    offset: Math.floor(Math.random() * (await Orders.count())),
                });
                const Commission3 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Commission3?.setOrder)
                {
                    await
                    Commission3.
                    setOrder(relatedOrder3);
                }
            
        }
        
    
        
            
            async function associateCommissionWithOrder_item() {
            
                const relatedOrder_item0 = await OrderItems.findOne({
                    offset: Math.floor(Math.random() * (await OrderItems.count())),
                });
                const Commission0 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Commission0?.setOrder_item)
                {
                    await
                    Commission0.
                    setOrder_item(relatedOrder_item0);
                }
            
                const relatedOrder_item1 = await OrderItems.findOne({
                    offset: Math.floor(Math.random() * (await OrderItems.count())),
                });
                const Commission1 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Commission1?.setOrder_item)
                {
                    await
                    Commission1.
                    setOrder_item(relatedOrder_item1);
                }
            
                const relatedOrder_item2 = await OrderItems.findOne({
                    offset: Math.floor(Math.random() * (await OrderItems.count())),
                });
                const Commission2 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Commission2?.setOrder_item)
                {
                    await
                    Commission2.
                    setOrder_item(relatedOrder_item2);
                }
            
                const relatedOrder_item3 = await OrderItems.findOne({
                    offset: Math.floor(Math.random() * (await OrderItems.count())),
                });
                const Commission3 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Commission3?.setOrder_item)
                {
                    await
                    Commission3.
                    setOrder_item(relatedOrder_item3);
                }
            
        }
        
    
        
            
            async function associateCommissionWithBeneficiary_user() {
            
                const relatedBeneficiary_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Commission0 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Commission0?.setBeneficiary_user)
                {
                    await
                    Commission0.
                    setBeneficiary_user(relatedBeneficiary_user0);
                }
            
                const relatedBeneficiary_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Commission1 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Commission1?.setBeneficiary_user)
                {
                    await
                    Commission1.
                    setBeneficiary_user(relatedBeneficiary_user1);
                }
            
                const relatedBeneficiary_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Commission2 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Commission2?.setBeneficiary_user)
                {
                    await
                    Commission2.
                    setBeneficiary_user(relatedBeneficiary_user2);
                }
            
                const relatedBeneficiary_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Commission3 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Commission3?.setBeneficiary_user)
                {
                    await
                    Commission3.
                    setBeneficiary_user(relatedBeneficiary_user3);
                }
            
        }
        
    
        
            
            async function associateCommissionWithCommission_plan() {
            
                const relatedCommission_plan0 = await CommissionPlans.findOne({
                    offset: Math.floor(Math.random() * (await CommissionPlans.count())),
                });
                const Commission0 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Commission0?.setCommission_plan)
                {
                    await
                    Commission0.
                    setCommission_plan(relatedCommission_plan0);
                }
            
                const relatedCommission_plan1 = await CommissionPlans.findOne({
                    offset: Math.floor(Math.random() * (await CommissionPlans.count())),
                });
                const Commission1 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Commission1?.setCommission_plan)
                {
                    await
                    Commission1.
                    setCommission_plan(relatedCommission_plan1);
                }
            
                const relatedCommission_plan2 = await CommissionPlans.findOne({
                    offset: Math.floor(Math.random() * (await CommissionPlans.count())),
                });
                const Commission2 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Commission2?.setCommission_plan)
                {
                    await
                    Commission2.
                    setCommission_plan(relatedCommission_plan2);
                }
            
                const relatedCommission_plan3 = await CommissionPlans.findOne({
                    offset: Math.floor(Math.random() * (await CommissionPlans.count())),
                });
                const Commission3 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Commission3?.setCommission_plan)
                {
                    await
                    Commission3.
                    setCommission_plan(relatedCommission_plan3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCommissionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Commission0 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Commission0?.setOrganization)
                {
                    await
                    Commission0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Commission1 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Commission1?.setOrganization)
                {
                    await
                    Commission1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Commission2 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Commission2?.setOrganization)
                {
                    await
                    Commission2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Commission3 = await Commissions.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Commission3?.setOrganization)
                {
                    await
                    Commission3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePayoutWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Payout0 = await Payouts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payout0?.setTenant)
                {
                    await
                    Payout0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Payout1 = await Payouts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payout1?.setTenant)
                {
                    await
                    Payout1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Payout2 = await Payouts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payout2?.setTenant)
                {
                    await
                    Payout2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Payout3 = await Payouts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Payout3?.setTenant)
                {
                    await
                    Payout3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
            
            async function associatePayoutWithRecipient_user() {
            
                const relatedRecipient_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Payout0 = await Payouts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payout0?.setRecipient_user)
                {
                    await
                    Payout0.
                    setRecipient_user(relatedRecipient_user0);
                }
            
                const relatedRecipient_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Payout1 = await Payouts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payout1?.setRecipient_user)
                {
                    await
                    Payout1.
                    setRecipient_user(relatedRecipient_user1);
                }
            
                const relatedRecipient_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Payout2 = await Payouts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payout2?.setRecipient_user)
                {
                    await
                    Payout2.
                    setRecipient_user(relatedRecipient_user2);
                }
            
                const relatedRecipient_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Payout3 = await Payouts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Payout3?.setRecipient_user)
                {
                    await
                    Payout3.
                    setRecipient_user(relatedRecipient_user3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePayoutWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payout0 = await Payouts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payout0?.setOrganization)
                {
                    await
                    Payout0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payout1 = await Payouts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payout1?.setOrganization)
                {
                    await
                    Payout1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payout2 = await Payouts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payout2?.setOrganization)
                {
                    await
                    Payout2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payout3 = await Payouts.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Payout3?.setOrganization)
                {
                    await
                    Payout3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateBonusProgramWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const BonusProgram0 = await BonusPrograms.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BonusProgram0?.setTenant)
                {
                    await
                    BonusProgram0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const BonusProgram1 = await BonusPrograms.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BonusProgram1?.setTenant)
                {
                    await
                    BonusProgram1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const BonusProgram2 = await BonusPrograms.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BonusProgram2?.setTenant)
                {
                    await
                    BonusProgram2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const BonusProgram3 = await BonusPrograms.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (BonusProgram3?.setTenant)
                {
                    await
                    BonusProgram3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateBonusProgramWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const BonusProgram0 = await BonusPrograms.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (BonusProgram0?.setOrganization)
                {
                    await
                    BonusProgram0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const BonusProgram1 = await BonusPrograms.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (BonusProgram1?.setOrganization)
                {
                    await
                    BonusProgram1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const BonusProgram2 = await BonusPrograms.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (BonusProgram2?.setOrganization)
                {
                    await
                    BonusProgram2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const BonusProgram3 = await BonusPrograms.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (BonusProgram3?.setOrganization)
                {
                    await
                    BonusProgram3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateReferralLinkWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ReferralLink0 = await ReferralLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReferralLink0?.setTenant)
                {
                    await
                    ReferralLink0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ReferralLink1 = await ReferralLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReferralLink1?.setTenant)
                {
                    await
                    ReferralLink1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ReferralLink2 = await ReferralLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReferralLink2?.setTenant)
                {
                    await
                    ReferralLink2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ReferralLink3 = await ReferralLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ReferralLink3?.setTenant)
                {
                    await
                    ReferralLink3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
            
            async function associateReferralLinkWithOwner_user() {
            
                const relatedOwner_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ReferralLink0 = await ReferralLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReferralLink0?.setOwner_user)
                {
                    await
                    ReferralLink0.
                    setOwner_user(relatedOwner_user0);
                }
            
                const relatedOwner_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ReferralLink1 = await ReferralLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReferralLink1?.setOwner_user)
                {
                    await
                    ReferralLink1.
                    setOwner_user(relatedOwner_user1);
                }
            
                const relatedOwner_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ReferralLink2 = await ReferralLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReferralLink2?.setOwner_user)
                {
                    await
                    ReferralLink2.
                    setOwner_user(relatedOwner_user2);
                }
            
                const relatedOwner_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ReferralLink3 = await ReferralLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ReferralLink3?.setOwner_user)
                {
                    await
                    ReferralLink3.
                    setOwner_user(relatedOwner_user3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateReferralLinkWithProduct() {
            
                const relatedProduct0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const ReferralLink0 = await ReferralLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReferralLink0?.setProduct)
                {
                    await
                    ReferralLink0.
                    setProduct(relatedProduct0);
                }
            
                const relatedProduct1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const ReferralLink1 = await ReferralLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReferralLink1?.setProduct)
                {
                    await
                    ReferralLink1.
                    setProduct(relatedProduct1);
                }
            
                const relatedProduct2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const ReferralLink2 = await ReferralLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReferralLink2?.setProduct)
                {
                    await
                    ReferralLink2.
                    setProduct(relatedProduct2);
                }
            
                const relatedProduct3 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const ReferralLink3 = await ReferralLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ReferralLink3?.setProduct)
                {
                    await
                    ReferralLink3.
                    setProduct(relatedProduct3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateReferralLinkWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ReferralLink0 = await ReferralLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReferralLink0?.setOrganization)
                {
                    await
                    ReferralLink0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ReferralLink1 = await ReferralLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReferralLink1?.setOrganization)
                {
                    await
                    ReferralLink1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ReferralLink2 = await ReferralLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReferralLink2?.setOrganization)
                {
                    await
                    ReferralLink2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ReferralLink3 = await ReferralLinks.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ReferralLink3?.setOrganization)
                {
                    await
                    ReferralLink3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateResellerStoreWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ResellerStore0 = await ResellerStores.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ResellerStore0?.setTenant)
                {
                    await
                    ResellerStore0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ResellerStore1 = await ResellerStores.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ResellerStore1?.setTenant)
                {
                    await
                    ResellerStore1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ResellerStore2 = await ResellerStores.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ResellerStore2?.setTenant)
                {
                    await
                    ResellerStore2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const ResellerStore3 = await ResellerStores.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ResellerStore3?.setTenant)
                {
                    await
                    ResellerStore3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
            
            async function associateResellerStoreWithOwner_user() {
            
                const relatedOwner_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ResellerStore0 = await ResellerStores.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ResellerStore0?.setOwner_user)
                {
                    await
                    ResellerStore0.
                    setOwner_user(relatedOwner_user0);
                }
            
                const relatedOwner_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ResellerStore1 = await ResellerStores.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ResellerStore1?.setOwner_user)
                {
                    await
                    ResellerStore1.
                    setOwner_user(relatedOwner_user1);
                }
            
                const relatedOwner_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ResellerStore2 = await ResellerStores.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ResellerStore2?.setOwner_user)
                {
                    await
                    ResellerStore2.
                    setOwner_user(relatedOwner_user2);
                }
            
                const relatedOwner_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ResellerStore3 = await ResellerStores.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ResellerStore3?.setOwner_user)
                {
                    await
                    ResellerStore3.
                    setOwner_user(relatedOwner_user3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateResellerStoreWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ResellerStore0 = await ResellerStores.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ResellerStore0?.setOrganization)
                {
                    await
                    ResellerStore0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ResellerStore1 = await ResellerStores.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ResellerStore1?.setOrganization)
                {
                    await
                    ResellerStore1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ResellerStore2 = await ResellerStores.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ResellerStore2?.setOrganization)
                {
                    await
                    ResellerStore2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ResellerStore3 = await ResellerStores.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (ResellerStore3?.setOrganization)
                {
                    await
                    ResellerStore3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateStorePageWithReseller_store() {
            
                const relatedReseller_store0 = await ResellerStores.findOne({
                    offset: Math.floor(Math.random() * (await ResellerStores.count())),
                });
                const StorePage0 = await StorePages.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (StorePage0?.setReseller_store)
                {
                    await
                    StorePage0.
                    setReseller_store(relatedReseller_store0);
                }
            
                const relatedReseller_store1 = await ResellerStores.findOne({
                    offset: Math.floor(Math.random() * (await ResellerStores.count())),
                });
                const StorePage1 = await StorePages.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (StorePage1?.setReseller_store)
                {
                    await
                    StorePage1.
                    setReseller_store(relatedReseller_store1);
                }
            
                const relatedReseller_store2 = await ResellerStores.findOne({
                    offset: Math.floor(Math.random() * (await ResellerStores.count())),
                });
                const StorePage2 = await StorePages.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (StorePage2?.setReseller_store)
                {
                    await
                    StorePage2.
                    setReseller_store(relatedReseller_store2);
                }
            
                const relatedReseller_store3 = await ResellerStores.findOne({
                    offset: Math.floor(Math.random() * (await ResellerStores.count())),
                });
                const StorePage3 = await StorePages.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (StorePage3?.setReseller_store)
                {
                    await
                    StorePage3.
                    setReseller_store(relatedReseller_store3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateStorePageWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const StorePage0 = await StorePages.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (StorePage0?.setOrganization)
                {
                    await
                    StorePage0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const StorePage1 = await StorePages.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (StorePage1?.setOrganization)
                {
                    await
                    StorePage1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const StorePage2 = await StorePages.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (StorePage2?.setOrganization)
                {
                    await
                    StorePage2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const StorePage3 = await StorePages.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (StorePage3?.setOrganization)
                {
                    await
                    StorePage3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateNotificationWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Notification0 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Notification0?.setTenant)
                {
                    await
                    Notification0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Notification1 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Notification1?.setTenant)
                {
                    await
                    Notification1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Notification2 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Notification2?.setTenant)
                {
                    await
                    Notification2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const Notification3 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Notification3?.setTenant)
                {
                    await
                    Notification3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
            
            async function associateNotificationWithRecipient_user() {
            
                const relatedRecipient_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Notification0 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Notification0?.setRecipient_user)
                {
                    await
                    Notification0.
                    setRecipient_user(relatedRecipient_user0);
                }
            
                const relatedRecipient_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Notification1 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Notification1?.setRecipient_user)
                {
                    await
                    Notification1.
                    setRecipient_user(relatedRecipient_user1);
                }
            
                const relatedRecipient_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Notification2 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Notification2?.setRecipient_user)
                {
                    await
                    Notification2.
                    setRecipient_user(relatedRecipient_user2);
                }
            
                const relatedRecipient_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Notification3 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Notification3?.setRecipient_user)
                {
                    await
                    Notification3.
                    setRecipient_user(relatedRecipient_user3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateNotificationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Notification0 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Notification0?.setOrganization)
                {
                    await
                    Notification0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Notification1 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Notification1?.setOrganization)
                {
                    await
                    Notification1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Notification2 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Notification2?.setOrganization)
                {
                    await
                    Notification2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Notification3 = await Notifications.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (Notification3?.setOrganization)
                {
                    await
                    Notification3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateAiInsightWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const AiInsight0 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiInsight0?.setTenant)
                {
                    await
                    AiInsight0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const AiInsight1 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiInsight1?.setTenant)
                {
                    await
                    AiInsight1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const AiInsight2 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiInsight2?.setTenant)
                {
                    await
                    AiInsight2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const AiInsight3 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AiInsight3?.setTenant)
                {
                    await
                    AiInsight3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateAiInsightWithRelated_user() {
            
                const relatedRelated_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AiInsight0 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiInsight0?.setRelated_user)
                {
                    await
                    AiInsight0.
                    setRelated_user(relatedRelated_user0);
                }
            
                const relatedRelated_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AiInsight1 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiInsight1?.setRelated_user)
                {
                    await
                    AiInsight1.
                    setRelated_user(relatedRelated_user1);
                }
            
                const relatedRelated_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AiInsight2 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiInsight2?.setRelated_user)
                {
                    await
                    AiInsight2.
                    setRelated_user(relatedRelated_user2);
                }
            
                const relatedRelated_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AiInsight3 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AiInsight3?.setRelated_user)
                {
                    await
                    AiInsight3.
                    setRelated_user(relatedRelated_user3);
                }
            
        }
        
    
        
            
            async function associateAiInsightWithRelated_product() {
            
                const relatedRelated_product0 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const AiInsight0 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiInsight0?.setRelated_product)
                {
                    await
                    AiInsight0.
                    setRelated_product(relatedRelated_product0);
                }
            
                const relatedRelated_product1 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const AiInsight1 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiInsight1?.setRelated_product)
                {
                    await
                    AiInsight1.
                    setRelated_product(relatedRelated_product1);
                }
            
                const relatedRelated_product2 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const AiInsight2 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiInsight2?.setRelated_product)
                {
                    await
                    AiInsight2.
                    setRelated_product(relatedRelated_product2);
                }
            
                const relatedRelated_product3 = await Products.findOne({
                    offset: Math.floor(Math.random() * (await Products.count())),
                });
                const AiInsight3 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AiInsight3?.setRelated_product)
                {
                    await
                    AiInsight3.
                    setRelated_product(relatedRelated_product3);
                }
            
        }
        
    
        
            
            async function associateAiInsightWithRelated_warehouse() {
            
                const relatedRelated_warehouse0 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const AiInsight0 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiInsight0?.setRelated_warehouse)
                {
                    await
                    AiInsight0.
                    setRelated_warehouse(relatedRelated_warehouse0);
                }
            
                const relatedRelated_warehouse1 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const AiInsight1 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiInsight1?.setRelated_warehouse)
                {
                    await
                    AiInsight1.
                    setRelated_warehouse(relatedRelated_warehouse1);
                }
            
                const relatedRelated_warehouse2 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const AiInsight2 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiInsight2?.setRelated_warehouse)
                {
                    await
                    AiInsight2.
                    setRelated_warehouse(relatedRelated_warehouse2);
                }
            
                const relatedRelated_warehouse3 = await Warehouses.findOne({
                    offset: Math.floor(Math.random() * (await Warehouses.count())),
                });
                const AiInsight3 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AiInsight3?.setRelated_warehouse)
                {
                    await
                    AiInsight3.
                    setRelated_warehouse(relatedRelated_warehouse3);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateAiInsightWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiInsight0 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiInsight0?.setOrganization)
                {
                    await
                    AiInsight0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiInsight1 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiInsight1?.setOrganization)
                {
                    await
                    AiInsight1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiInsight2 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiInsight2?.setOrganization)
                {
                    await
                    AiInsight2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiInsight3 = await AiInsights.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (AiInsight3?.setOrganization)
                {
                    await
                    AiInsight3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    

    
    
    
        
            
            async function associateSalesTargetWithTenant() {
            
                const relatedTenant0 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const SalesTarget0 = await SalesTargets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesTarget0?.setTenant)
                {
                    await
                    SalesTarget0.
                    setTenant(relatedTenant0);
                }
            
                const relatedTenant1 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const SalesTarget1 = await SalesTargets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesTarget1?.setTenant)
                {
                    await
                    SalesTarget1.
                    setTenant(relatedTenant1);
                }
            
                const relatedTenant2 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const SalesTarget2 = await SalesTargets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesTarget2?.setTenant)
                {
                    await
                    SalesTarget2.
                    setTenant(relatedTenant2);
                }
            
                const relatedTenant3 = await Tenants.findOne({
                    offset: Math.floor(Math.random() * (await Tenants.count())),
                });
                const SalesTarget3 = await SalesTargets.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (SalesTarget3?.setTenant)
                {
                    await
                    SalesTarget3.
                    setTenant(relatedTenant3);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateSalesTargetWithTarget_user() {
            
                const relatedTarget_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SalesTarget0 = await SalesTargets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesTarget0?.setTarget_user)
                {
                    await
                    SalesTarget0.
                    setTarget_user(relatedTarget_user0);
                }
            
                const relatedTarget_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SalesTarget1 = await SalesTargets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesTarget1?.setTarget_user)
                {
                    await
                    SalesTarget1.
                    setTarget_user(relatedTarget_user1);
                }
            
                const relatedTarget_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SalesTarget2 = await SalesTargets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesTarget2?.setTarget_user)
                {
                    await
                    SalesTarget2.
                    setTarget_user(relatedTarget_user2);
                }
            
                const relatedTarget_user3 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SalesTarget3 = await SalesTargets.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (SalesTarget3?.setTarget_user)
                {
                    await
                    SalesTarget3.
                    setTarget_user(relatedTarget_user3);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateSalesTargetWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SalesTarget0 = await SalesTargets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SalesTarget0?.setOrganization)
                {
                    await
                    SalesTarget0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SalesTarget1 = await SalesTargets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SalesTarget1?.setOrganization)
                {
                    await
                    SalesTarget1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SalesTarget2 = await SalesTargets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SalesTarget2?.setOrganization)
                {
                    await
                    SalesTarget2.
                    setOrganization(relatedOrganization2);
                }
            
                const relatedOrganization3 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SalesTarget3 = await SalesTargets.findOne({
                    order: [['id', 'ASC']],
                    offset: 3
                });
                if (SalesTarget3?.setOrganization)
                {
                    await
                    SalesTarget3.
                    setOrganization(relatedOrganization3);
                }
            
        }
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Organizations.bulkCreate(OrganizationsData);
                
            
            
                
                await Tenants.bulkCreate(TenantsData);
                
            
            
                
                await Products.bulkCreate(ProductsData);
                
            
            
                
                await Warehouses.bulkCreate(WarehousesData);
                
            
            
                
                await InventoryItems.bulkCreate(InventoryItemsData);
                
            
            
                
                await InventoryMovements.bulkCreate(InventoryMovementsData);
                
            
            
                
                await Customers.bulkCreate(CustomersData);
                
            
            
                
                await Orders.bulkCreate(OrdersData);
                
            
            
                
                await OrderItems.bulkCreate(OrderItemsData);
                
            
            
                
                await Invoices.bulkCreate(InvoicesData);
                
            
            
                
                await Payments.bulkCreate(PaymentsData);
                
            
            
                
                await CommissionPlans.bulkCreate(CommissionPlansData);
                
            
            
                
                await CommissionRules.bulkCreate(CommissionRulesData);
                
            
            
                
                await Commissions.bulkCreate(CommissionsData);
                
            
            
                
                await Payouts.bulkCreate(PayoutsData);
                
            
            
                
                await BonusPrograms.bulkCreate(BonusProgramsData);
                
            
            
                
                await ReferralLinks.bulkCreate(ReferralLinksData);
                
            
            
                
                await ResellerStores.bulkCreate(ResellerStoresData);
                
            
            
                
                await StorePages.bulkCreate(StorePagesData);
                
            
            
                
                await Notifications.bulkCreate(NotificationsData);
                
            
            
                
                await AiInsights.bulkCreate(AiInsightsData);
                
            
            
                
                await SalesTargets.bulkCreate(SalesTargetsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateUserWithOrganization(),
                    
                
            
                
                
                
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateTenantWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateProductWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateProductWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateWarehousWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateWarehousWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateInventoryItemWithTenant(),
                    
                
                    
                        
                        await associateInventoryItemWithProduct(),
                    
                
                    
                        
                        await associateInventoryItemWithWarehouse(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInventoryItemWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateInventoryMovementWithTenant(),
                    
                
                    
                        
                        await associateInventoryMovementWithWarehouse(),
                    
                
                    
                        
                        await associateInventoryMovementWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInventoryMovementWithPerformed_by(),
                    
                
                    
                
                    
                
                    
                        
                        await associateInventoryMovementWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCustomerWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCustomerWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateOrderWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateOrderWithCustomer(),
                    
                
                    
                        
                        await associateOrderWithSeller_user(),
                    
                
                    
                        
                        await associateOrderWithWarehouse(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateOrderWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateOrderItemWithOrder(),
                    
                
                    
                        
                        await associateOrderItemWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateOrderItemWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateInvoiceWithTenant(),
                    
                
                    
                        
                        await associateInvoiceWithOrder(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInvoiceWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePaymentWithTenant(),
                    
                
                    
                        
                        await associatePaymentWithOrder(),
                    
                
                    
                        
                        await associatePaymentWithInvoice(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePaymentWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCommissionPlanWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCommissionPlanWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCommissionRuleWithCommission_plan(),
                    
                
                    
                
                    
                        
                        await associateCommissionRuleWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCommissionRuleWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCommissionWithTenant(),
                    
                
                    
                        
                        await associateCommissionWithOrder(),
                    
                
                    
                        
                        await associateCommissionWithOrder_item(),
                    
                
                    
                        
                        await associateCommissionWithBeneficiary_user(),
                    
                
                    
                        
                        await associateCommissionWithCommission_plan(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCommissionWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePayoutWithTenant(),
                    
                
                    
                
                    
                        
                        await associatePayoutWithRecipient_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePayoutWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateBonusProgramWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateBonusProgramWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateReferralLinkWithTenant(),
                    
                
                    
                        
                        await associateReferralLinkWithOwner_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateReferralLinkWithProduct(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateReferralLinkWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateResellerStoreWithTenant(),
                    
                
                    
                        
                        await associateResellerStoreWithOwner_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateResellerStoreWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateStorePageWithReseller_store(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateStorePageWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateNotificationWithTenant(),
                    
                
                    
                        
                        await associateNotificationWithRecipient_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateNotificationWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateAiInsightWithTenant(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateAiInsightWithRelated_user(),
                    
                
                    
                        
                        await associateAiInsightWithRelated_product(),
                    
                
                    
                        
                        await associateAiInsightWithRelated_warehouse(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateAiInsightWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateSalesTargetWithTenant(),
                    
                
                    
                
                    
                
                    
                        
                        await associateSalesTargetWithTarget_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSalesTargetWithOrganization(),
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('organizations', null, {});
            
            
            await queryInterface.bulkDelete('tenants', null, {});
            
            
            await queryInterface.bulkDelete('products', null, {});
            
            
            await queryInterface.bulkDelete('warehouses', null, {});
            
            
            await queryInterface.bulkDelete('inventory_items', null, {});
            
            
            await queryInterface.bulkDelete('inventory_movements', null, {});
            
            
            await queryInterface.bulkDelete('customers', null, {});
            
            
            await queryInterface.bulkDelete('orders', null, {});
            
            
            await queryInterface.bulkDelete('order_items', null, {});
            
            
            await queryInterface.bulkDelete('invoices', null, {});
            
            
            await queryInterface.bulkDelete('payments', null, {});
            
            
            await queryInterface.bulkDelete('commission_plans', null, {});
            
            
            await queryInterface.bulkDelete('commission_rules', null, {});
            
            
            await queryInterface.bulkDelete('commissions', null, {});
            
            
            await queryInterface.bulkDelete('payouts', null, {});
            
            
            await queryInterface.bulkDelete('bonus_programs', null, {});
            
            
            await queryInterface.bulkDelete('referral_links', null, {});
            
            
            await queryInterface.bulkDelete('reseller_stores', null, {});
            
            
            await queryInterface.bulkDelete('store_pages', null, {});
            
            
            await queryInterface.bulkDelete('notifications', null, {});
            
            
            await queryInterface.bulkDelete('ai_insights', null, {});
            
            
            await queryInterface.bulkDelete('sales_targets', null, {});
            
        
    },
};