





















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






const Organizations = db.organizations;

const OrganizationInvitations = db.organization_invitations;

const Customers = db.customers;

const SavedAddresses = db.saved_addresses;

const ServicePackages = db.service_packages;

const ServiceAddOns = db.service_add_ons;

const ServiceRequests = db.service_requests;

const ServiceRequestAddOns = db.service_request_add_ons;

const RequestChecklistItems = db.request_checklist_items;

const RequestTimelineEvents = db.request_timeline_events;

const RequestDocuments = db.request_documents;

const ChatThreads = db.chat_threads;

const ChatMessages = db.chat_messages;

const PaymentTransactions = db.payment_transactions;

const Invoices = db.invoices;

const Subscriptions = db.subscriptions;

const LegalDocuments = db.legal_documents;

const DocumentAcceptances = db.document_acceptances;

const SupportTickets = db.support_tickets;

const Leads = db.leads;

const Notifications = db.notifications;

const AuditLogs = db.audit_logs;

const WebhookEndpoints = db.webhook_endpoints;

const WebhookDeliveries = db.webhook_deliveries;

const CsvJobs = db.csv_jobs;

const UsageEvents = db.usage_events;







const OrganizationsData = [
    
    {
    
        
        
            
                "name": "Entangle Retrievals HQ",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Willow & Co Partners",
            
        
    
    },
    
    {
    
        
        
            
                "name": "North Shore Executive Services",
            
        
    
    },
    
];



const OrganizationInvitationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invite_email": "new.coordinator@entangle.example",
            
        
    
        
        
            
                "invite_role": "partner",
            
        
    
        
        
            
                "invite_token": "inv_6f3a2c9b1e",
            
        
    
        
        
            
                "expires_at": new Date('2026-06-15T23:59:59Z'),
            
        
    
        
        
            
                "accepted_at": new Date('2026-06-01T10:00:00Z'),
            
        
    
        
        
            
                "status": "expired",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invite_email": "case.manager@willowco.example",
            
        
    
        
        
            
                "invite_role": "coordinator",
            
        
    
        
        
            
                "invite_token": "inv_19c8d2a77f",
            
        
    
        
        
            
                "expires_at": new Date('2026-06-20T23:59:59Z'),
            
        
    
        
        
            
                "accepted_at": new Date('2026-06-02T09:30:00Z'),
            
        
    
        
        
            
                "status": "accepted",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invite_email": "partner.ops@northshore.example",
            
        
    
        
        
            
                "invite_role": "coordinator",
            
        
    
        
        
            
                "invite_token": "inv_2e9d6c31aa",
            
        
    
        
        
            
                "expires_at": new Date('2026-06-10T23:59:59Z'),
            
        
    
        
        
            
                "accepted_at": new Date('2026-05-25T15:40:00Z'),
            
        
    
        
        
            
                "status": "pending",
            
        
    
    },
    
];



const CustomersData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "full_name": "Jennifer Carter",
            
        
    
        
        
            
                "email": "jennifer.carter@northshore.example",
            
        
    
        
        
            
                "phone": "+13105550905",
            
        
    
        
        
            
                "status": "blocked",
            
        
    
        
        
            
                "preferred_contact_method": "SMS",
            
        
    
        
        
            
                "notes": "Prefers concise updates and morning check-ins.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "full_name": "Taylor Brooks",
            
        
    
        
        
            
                "email": "taylor.brooks@example.com",
            
        
    
        
        
            
                "phone": "+14155550711",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "preferred_contact_method": "Email",
            
        
    
        
        
            
                "notes": "Requests often include document handling and scheduled coordination.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "full_name": "Riley Chen",
            
        
    
        
        
            
                "email": "riley.chen@example.com",
            
        
    
        
        
            
                "phone": "+16465550712",
            
        
    
        
        
            
                "status": "inactive",
            
        
    
        
        
            
                "preferred_contact_method": "Phone",
            
        
    
        
        
            
                "notes": "Needs two-party scheduling support for property access.",
            
        
    
    },
    
];



const SavedAddressesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "label": "Home",
            
        
    
        
        
            
                "recipient_name": "Jennifer Carter",
            
        
    
        
        
            
                "phone": "+13105550905",
            
        
    
        
        
            
                "line1": "1287 Seaview Ave",
            
        
    
        
        
            
                "line2": "Unit 12B",
            
        
    
        
        
            
                "city": "New York",
            
        
    
        
        
            
                "region": "NY",
            
        
    
        
        
            
                "postal_code": "10021",
            
        
    
        
        
            
                "country": "US",
            
        
    
        
        
            
                "latitude": 40.7731,
            
        
    
        
        
            
                "longitude": -73.9567,
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "label": "Office",
            
        
    
        
        
            
                "recipient_name": "Taylor Brooks",
            
        
    
        
        
            
                "phone": "+14155550711",
            
        
    
        
        
            
                "line1": "500 Market St",
            
        
    
        
        
            
                "line2": "Suite 900",
            
        
    
        
        
            
                "city": "San Francisco",
            
        
    
        
        
            
                "region": "CA",
            
        
    
        
        
            
                "postal_code": "94105",
            
        
    
        
        
            
                "country": "US",
            
        
    
        
        
            
                "latitude": 37.7897,
            
        
    
        
        
            
                "longitude": -122.4011,
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "label": "Property Site",
            
        
    
        
        
            
                "recipient_name": "Riley Chen",
            
        
    
        
        
            
                "phone": "+16465550712",
            
        
    
        
        
            
                "line1": "44 Crescent Hill Rd",
            
        
    
        
        
            
                "line2": "Gate Code 1842",
            
        
    
        
        
            
                "city": "Chicago",
            
        
    
        
        
            
                "region": "IL",
            
        
    
        
        
            
                "postal_code": "60611",
            
        
    
        
        
            
                "country": "US",
            
        
    
        
        
            
                "latitude": 41.8925,
            
        
    
        
        
            
                "longitude": -87.6262,
            
        
    
        
        
            
                "is_default": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ServicePackagesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Quick Assist",
            
        
    
        
        
            
                "code": "quick_assist",
            
        
    
        
        
            
                "description": "Basic coordination for a single request with status updates and customer support.",
            
        
    
        
        
            
                "price": 79,
            
        
    
        
        
            
                "billing_type": "one_time",
            
        
    
        
        
            
                "stripe_price_ref": "price_quick_assist_usd",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Essential Support",
            
        
    
        
        
            
                "code": "essential_support",
            
        
    
        
        
            
                "description": "Extended coordination including documentation support and proactive updates.",
            
        
    
        
        
            
                "price": 129,
            
        
    
        
        
            
                "billing_type": "one_time",
            
        
    
        
        
            
                "stripe_price_ref": "price_essential_support_usd",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Premium Support",
            
        
    
        
        
            
                "code": "premium_support",
            
        
    
        
        
            
                "description": "Priority handling with enhanced communication and a dedicated coordinator.",
            
        
    
        
        
            
                "price": 199,
            
        
    
        
        
            
                "billing_type": "subscription",
            
        
    
        
        
            
                "stripe_price_ref": "price_premium_support_usd",
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
];



const ServiceAddOnsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Stair Assistance",
            
        
    
        
        
            
                "code": "stair_assistance",
            
        
    
        
        
            
                "description": "Additional coordination for stair-related access and handling, per flight.",
            
        
    
        
        
            
                "pricing_model": "per_unit",
            
        
    
        
        
            
                "unit_price": 15,
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "No Contact Coordination",
            
        
    
        
        
            
                "code": "no_contact",
            
        
    
        
        
            
                "description": "Enhanced privacy workflow and discreet coordination without direct contact.",
            
        
    
        
        
            
                "pricing_model": "flat",
            
        
    
        
        
            
                "unit_price": 75,
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Rush Priority",
            
        
    
        
        
            
                "code": "rush_priority",
            
        
    
        
        
            
                "description": "Accelerated handling and prioritized coordination response.",
            
        
    
        
        
            
                "pricing_model": "flat",
            
        
    
        
        
            
                "unit_price": 50,
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
];



const ServiceRequestsData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "service_type": "retrieval",
            
        
    
        
        
            
                "timing_preference": "scheduled",
            
        
    
        
        
            
                "scheduled_start_at": new Date('2026-06-03T14:00:00Z'),
            
        
    
        
        
            
                "scheduled_end_at": new Date('2026-06-03T16:00:00Z'),
            
        
    
        
        
            
                "summary": "Retrieve signed documents from office",
            
        
    
        
        
            
                "description": "Please coordinate retrieval of the signed agreement packet from my office reception and confirm receipt by photo.",
            
        
    
        
        
            
                "status": "coordinator_assigned",
            
        
    
        
        
            
                "priority": "after_hours",
            
        
    
        
        
            
                "estimated_total": 199,
            
        
    
        
        
            
                "final_total": 0,
            
        
    
        
        
            
                "submitted_at": new Date('2026-06-01T13:20:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-06-10T00:00:00Z'),
            
        
    
        
        
            
                "requires_no_contact_coordination": true,
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "service_type": "concierge_assistance",
            
        
    
        
        
            
                "timing_preference": "asap",
            
        
    
        
        
            
                "scheduled_start_at": new Date('2026-06-02T18:00:00Z'),
            
        
    
        
        
            
                "scheduled_end_at": new Date('2026-06-02T20:00:00Z'),
            
        
    
        
        
            
                "summary": "Schedule two appointments and confirm availability",
            
        
    
        
        
            
                "description": "Coordinate scheduling with two offices, secure confirmations by email, and upload confirmations to the request.",
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "priority": "standard",
            
        
    
        
        
            
                "estimated_total": 129,
            
        
    
        
        
            
                "final_total": 0,
            
        
    
        
        
            
                "submitted_at": new Date('2026-06-02T15:10:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-06-12T00:00:00Z'),
            
        
    
        
        
            
                "requires_no_contact_coordination": false,
            
        
    
    },
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "service_type": "premium_coordination",
            
        
    
        
        
            
                "timing_preference": "flexible",
            
        
    
        
        
            
                "scheduled_start_at": new Date('2026-06-05T15:00:00Z'),
            
        
    
        
        
            
                "scheduled_end_at": new Date('2026-06-05T18:00:00Z'),
            
        
    
        
        
            
                "summary": "Coordinate property access with vendor",
            
        
    
        
        
            
                "description": "Please align schedules between vendor and property manager, confirm access window, and share instructions.",
            
        
    
        
        
            
                "status": "coordinator_assigned",
            
        
    
        
        
            
                "priority": "standard",
            
        
    
        
        
            
                "estimated_total": 299,
            
        
    
        
        
            
                "final_total": 0,
            
        
    
        
        
            
                "submitted_at": new Date('2026-06-01T17:40:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-06-15T00:00:00Z'),
            
        
    
        
        
            
                "requires_no_contact_coordination": true,
            
        
    
    },
    
];



const ServiceRequestAddOnsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_price": 50,
            
        
    
        
        
            
                "line_total": 50,
            
        
    
        
        
            
                "notes": "Prioritize coordinator outreach and confirmations.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_price": 75,
            
        
    
        
        
            
                "line_total": 75,
            
        
    
        
        
            
                "notes": "Use discreet communication and minimal contact.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "quantity": 1,
            
        
    
        
        
            
                "unit_price": 50,
            
        
    
        
        
            
                "line_total": 50,
            
        
    
        
        
            
                "notes": "Calls may need to occur after 6pm local time.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const RequestChecklistItemsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Confirm pickup location and hours",
            
        
    
        
        
            
                "details": "Verify reception hours and pickup requirements.",
            
        
    
        
        
            
                "status": "todo",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-06-02T17:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-02T16:35:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Obtain proof of receipt",
            
        
    
        
        
            
                "details": "Request photo confirmation upon retrieval.",
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-06-03T16:30:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-10T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "title": "Contact Office A for scheduling",
            
        
    
        
        
            
                "details": "Call and confirm earliest available slot.",
            
        
    
        
        
            
                "status": "done",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "due_at": new Date('2026-06-02T16:30:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-02T16:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const RequestTimelineEventsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "case_closed",
            
        
    
        
        
            
                "event_title": "Request submitted",
            
        
    
        
        
            
                "event_detail": "Customer submitted retrieval request with scheduled window.",
            
        
    
        
        
            
                "event_at": new Date('2026-06-01T13:20:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "case_closed",
            
        
    
        
        
            
                "event_title": "Coordinator assigned",
            
        
    
        
        
            
                "event_detail": "Assigned coordinator Sage Nguyen to the case.",
            
        
    
        
        
            
                "event_at": new Date('2026-06-01T13:45:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "request_created",
            
        
    
        
        
            
                "event_title": "Status updated to coordination active",
            
        
    
        
        
            
                "event_detail": "Coordination initiated; outreach in progress.",
            
        
    
        
        
            
                "event_at": new Date('2026-06-02T15:40:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const RequestDocumentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "document_type": "agreement",
            
        
    
        
        
            
                "title": "Agreement packet reference",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_sensitive": true,
            
        
    
        
        
            
                "uploaded_at": new Date('2026-06-01T13:25:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "document_type": "agreement",
            
        
    
        
        
            
                "title": "Confirmation emails PDF",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_sensitive": true,
            
        
    
        
        
            
                "uploaded_at": new Date('2026-06-02T19:15:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "document_type": "photo",
            
        
    
        
        
            
                "title": "Access instructions",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "images" field
            
        
    
        
        
            
                "is_sensitive": false,
            
        
    
        
        
            
                "uploaded_at": new Date('2026-06-01T18:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ChatThreadsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "subject": "Retrieval coordination updates",
            
        
    
        
        
            
                "thread_type": "partner_customer",
            
        
    
        
        
            
                "last_message_at": new Date('2026-06-02T16:40:00Z'),
            
        
    
        
        
            
                "status": "archived",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "subject": "Scheduling confirmations",
            
        
    
        
        
            
                "thread_type": "customer_coordinator",
            
        
    
        
        
            
                "last_message_at": new Date('2026-06-02T19:20:00Z'),
            
        
    
        
        
            
                "status": "open",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "subject": "Access window coordination",
            
        
    
        
        
            
                "thread_type": "internal_team",
            
        
    
        
        
            
                "last_message_at": new Date('2026-06-02T18:10:00Z'),
            
        
    
        
        
            
                "status": "open",
            
        
    
    },
    
];



const ChatMessagesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "message_type": "system",
            
        
    
        
        
            
                "body": "Thank you. Please keep updates brief and confirm once the packet is secured.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "sent_at": new Date('2026-06-01T13:50:00Z'),
            
        
    
        
        
            
                "is_read": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "message_type": "system",
            
        
    
        
        
            
                "body": "Coordinator assigned. Confirming pickup details now.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "sent_at": new Date('2026-06-01T14:00:00Z'),
            
        
    
        
        
            
                "is_read": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "message_type": "text",
            
        
    
        
        
            
                "body": "Office A confirmed 10:30am Thursday. Office B pending callback. I will update within 60 minutes.",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "sent_at": new Date('2026-06-02T18:05:00Z'),
            
        
    
        
        
            
                "is_read": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PaymentTransactionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider": "stripe",
            
        
    
        
        
            
                "transaction_type": "payment_intent",
            
        
    
        
        
            
                "provider_reference": "pi_3NXX01premium",
            
        
    
        
        
            
                "amount": 199,
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "processed_at": new Date('2026-06-01T13:28:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider": "stripe",
            
        
    
        
        
            
                "transaction_type": "invoice_payment",
            
        
    
        
        
            
                "provider_reference": "pi_3NXX02essential",
            
        
    
        
        
            
                "amount": 129,
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "status": "refunded",
            
        
    
        
        
            
                "processed_at": new Date('2026-06-02T15:12:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider": "stripe",
            
        
    
        
        
            
                "transaction_type": "invoice_payment",
            
        
    
        
        
            
                "provider_reference": "pi_3NXX03twoparty",
            
        
    
        
        
            
                "amount": 299,
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "processed_at": new Date('2026-06-01T18:00:00Z'),
            
        
    
    },
    
];



const InvoicesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "INV-2026-00021",
            
        
    
        
        
            
                "provider_reference": "in_1NXX21",
            
        
    
        
        
            
                "subtotal": 199,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 199,
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "status": "paid",
            
        
    
        
        
            
                "issued_at": new Date('2026-06-01T13:28:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-01T13:28:00Z'),
            
        
    
        
        
            
                "paid_at": new Date('2026-06-01T13:29:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "INV-2026-00022",
            
        
    
        
        
            
                "provider_reference": "in_1NXX22",
            
        
    
        
        
            
                "subtotal": 129,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 129,
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "status": "open",
            
        
    
        
        
            
                "issued_at": new Date('2026-06-02T15:12:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-02T15:12:00Z'),
            
        
    
        
        
            
                "paid_at": new Date('2026-06-02T15:13:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "invoice_number": "INV-2026-00023",
            
        
    
        
        
            
                "provider_reference": "in_1NXX23",
            
        
    
        
        
            
                "subtotal": 299,
            
        
    
        
        
            
                "tax_total": 0,
            
        
    
        
        
            
                "total": 299,
            
        
    
        
        
            
                "currency": "USD",
            
        
    
        
        
            
                "status": "uncollectible",
            
        
    
        
        
            
                "issued_at": new Date('2026-06-01T18:00:00Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-03T18:00:00Z'),
            
        
    
        
        
            
                "paid_at": new Date('2026-06-10T00:00:00Z'),
            
        
    
    },
    
];



const SubscriptionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider_reference": "sub_1NXXA1",
            
        
    
        
        
            
                "status": "trialing",
            
        
    
        
        
            
                "current_period_start_at": new Date('2026-06-01T00:00:00Z'),
            
        
    
        
        
            
                "current_period_end_at": new Date('2026-07-01T00:00:00Z'),
            
        
    
        
        
            
                "cancelled_at": new Date('2026-06-10T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider_reference": "sub_1NXXA2",
            
        
    
        
        
            
                "status": "paused",
            
        
    
        
        
            
                "current_period_start_at": new Date('2026-05-15T00:00:00Z'),
            
        
    
        
        
            
                "current_period_end_at": new Date('2026-06-15T00:00:00Z'),
            
        
    
        
        
            
                "cancelled_at": new Date('2026-06-10T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider_reference": "sub_1NXXA3",
            
        
    
        
        
            
                "status": "paused",
            
        
    
        
        
            
                "current_period_start_at": new Date('2026-04-01T00:00:00Z'),
            
        
    
        
        
            
                "current_period_end_at": new Date('2026-05-01T00:00:00Z'),
            
        
    
        
        
            
                "cancelled_at": new Date('2026-04-15T12:00:00Z'),
            
        
    
    },
    
];



const LegalDocumentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "document_kind": "electronic_signature_consent",
            
        
    
        
        
            
                "title": "Terms of Service",
            
        
    
        
        
            
                "version": "2026.01",
            
        
    
        
        
            
                "content": "Standard terms governing use of the Entangle Retrievals platform.",
            
        
    
        
        
            
                "effective_at": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "document_kind": "electronic_signature_consent",
            
        
    
        
        
            
                "title": "Privacy Policy",
            
        
    
        
        
            
                "version": "2026.01",
            
        
    
        
        
            
                "content": "Policy describing data handling, retention, and privacy rights.",
            
        
    
        
        
            
                "effective_at": new Date('2026-01-01T00:00:00Z'),
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "document_kind": "electronic_signature_consent",
            
        
    
        
        
            
                "title": "Service Agreement",
            
        
    
        
        
            
                "version": "2026.02",
            
        
    
        
        
            
                "content": "Agreement outlining coordination scope, responsibilities, and service limitations.",
            
        
    
        
        
            
                "effective_at": new Date('2026-02-01T00:00:00Z'),
            
        
    
        
        
            
                "is_active": true,
            
        
    
    },
    
];



const DocumentAcceptancesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "accepted_at": new Date('2026-05-20T12:00:00Z'),
            
        
    
        
        
            
                "ip_address": "203.0.113.10",
            
        
    
        
        
            
                "user_agent": "Mozilla/5.0 MacIntel Chrome",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "accepted_at": new Date('2026-05-20T12:01:00Z'),
            
        
    
        
        
            
                "ip_address": "203.0.113.10",
            
        
    
        
        
            
                "user_agent": "Mozilla/5.0 MacIntel Chrome",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "accepted_at": new Date('2026-06-02T15:09:00Z'),
            
        
    
        
        
            
                "ip_address": "198.51.100.22",
            
        
    
        
        
            
                "user_agent": "Mozilla/5.0 Windows Chrome",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SupportTicketsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "subject": "Update my request notification settings",
            
        
    
        
        
            
                "description": "Please switch status updates to SMS only for this request.",
            
        
    
        
        
            
                "priority": "urgent",
            
        
    
        
        
            
                "status": "in_progress",
            
        
    
        
        
            
                "opened_at": new Date('2026-06-01T14:10:00Z'),
            
        
    
        
        
            
                "resolved_at": new Date('2026-06-10T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "subject": "Upload confirmation document not visible",
            
        
    
        
        
            
                "description": "The uploaded PDF appears missing in my activity feed.",
            
        
    
        
        
            
                "priority": "high",
            
        
    
        
        
            
                "status": "resolved",
            
        
    
        
        
            
                "opened_at": new Date('2026-06-02T19:30:00Z'),
            
        
    
        
        
            
                "resolved_at": new Date('2026-06-10T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "subject": "Add an additional contact to the case",
            
        
    
        
        
            
                "description": "Please include the vendor supervisor for updates and scheduling.",
            
        
    
        
        
            
                "priority": "high",
            
        
    
        
        
            
                "status": "waiting_on_customer",
            
        
    
        
        
            
                "opened_at": new Date('2026-06-02T18:20:00Z'),
            
        
    
        
        
            
                "resolved_at": new Date('2026-06-10T00:00:00Z'),
            
        
    
    },
    
];



const LeadsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "company_name": "Lighthouse Executive Assist",
            
        
    
        
        
            
                "contact_name": "Mina Park",
            
        
    
        
        
            
                "email": "mina@lighthouseea.example",
            
        
    
        
        
            
                "phone": "+14155550601",
            
        
    
        
        
            
                "source": "Website",
            
        
    
        
        
            
                "stage": "quoted",
            
        
    
        
        
            
                "estimated_value": 1500,
            
        
    
        
        
            
                "notes": "Interested in executive coordination for VIP clients; wants usage analytics reporting.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "next_follow_up_at": new Date('2026-06-05T17:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "company_name": "Silverline Property Services",
            
        
    
        
        
            
                "contact_name": "Noah Davis",
            
        
    
        
        
            
                "email": "noah@silverlineps.example",
            
        
    
        
        
            
                "phone": "+14155550602",
            
        
    
        
        
            
                "source": "Referral",
            
        
    
        
        
            
                "stage": "quoted",
            
        
    
        
        
            
                "estimated_value": 900,
            
        
    
        
        
            
                "notes": "Exploring two-party coordination for tenant move-in workflows.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "next_follow_up_at": new Date('2026-06-04T19:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "company_name": "Harborview Care Network",
            
        
    
        
        
            
                "contact_name": "Elena Rossi",
            
        
    
        
        
            
                "email": "elena@harborviewcare.example",
            
        
    
        
        
            
                "phone": "+12135550603",
            
        
    
        
        
            
                "source": "Event",
            
        
    
        
        
            
                "stage": "active",
            
        
    
        
        
            
                "estimated_value": 2400,
            
        
    
        
        
            
                "notes": "Requested pricing for concierge assistance with after-hours coverage.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "next_follow_up_at": new Date('2026-06-06T15:00:00Z'),
            
        
    
    },
    
];



const NotificationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "channel": "in_app",
            
        
    
        
        
            
                "event_key": "new_request",
            
        
    
        
        
            
                "title": "Request status updated",
            
        
    
        
        
            
                "body": "Your request is now in progress.",
            
        
    
        
        
            
                "deep_link": "/requests/1",
            
        
    
        
        
            
                "sent_at": new Date('2026-06-01T14:05:00Z'),
            
        
    
        
        
            
                "read_at": new Date('2026-06-01T14:10:00Z'),
            
        
    
        
        
            
                "status": "queued",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "channel": "email",
            
        
    
        
        
            
                "event_key": "payment_success",
            
        
    
        
        
            
                "title": "New request submitted",
            
        
    
        
        
            
                "body": "A new service request has been submitted and is awaiting assignment.",
            
        
    
        
        
            
                "deep_link": "/admin/requests",
            
        
    
        
        
            
                "sent_at": new Date('2026-06-02T15:12:30Z'),
            
        
    
        
        
            
                "read_at": new Date('2026-06-10T00:00:00Z'),
            
        
    
        
        
            
                "status": "queued",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "channel": "email",
            
        
    
        
        
            
                "event_key": "payment_success",
            
        
    
        
        
            
                "title": "You have been assigned a case",
            
        
    
        
        
            
                "body": "A service request has been assigned to you. Please review and start coordination.",
            
        
    
        
        
            
                "deep_link": "/coordinator/cases/1",
            
        
    
        
        
            
                "sent_at": new Date('2026-06-01T13:46:00Z'),
            
        
    
        
        
            
                "read_at": new Date('2026-06-10T00:00:00Z'),
            
        
    
        
        
            
                "status": "queued",
            
        
    
    },
    
];



const AuditLogsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action": "organization.created",
            
        
    
        
        
            
                "entity_name": "organizations",
            
        
    
        
        
            
                "entity_reference": "entangle-hq",
            
        
    
        
        
            
                "summary": "Created tenant organization Entangle Retrievals HQ.",
            
        
    
        
        
            
                "ip_address": "192.0.2.10",
            
        
    
        
        
            
                "user_agent": "Mozilla/5.0 MacIntel Chrome",
            
        
    
        
        
            
                "occurred_at": new Date('2026-01-10T10:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action": "request.assigned",
            
        
    
        
        
            
                "entity_name": "service_requests",
            
        
    
        
        
            
                "entity_reference": "Retrieve signed documents from office",
            
        
    
        
        
            
                "summary": "Assigned coordinator to request.",
            
        
    
        
        
            
                "ip_address": "192.0.2.11",
            
        
    
        
        
            
                "user_agent": "Mozilla/5.0 MacIntel Chrome",
            
        
    
        
        
            
                "occurred_at": new Date('2026-06-01T13:45:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action": "document.uploaded",
            
        
    
        
        
            
                "entity_name": "request_documents",
            
        
    
        
        
            
                "entity_reference": "Agreement packet reference",
            
        
    
        
        
            
                "summary": "Uploaded a document to the request.",
            
        
    
        
        
            
                "ip_address": "192.0.2.12",
            
        
    
        
        
            
                "user_agent": "Mozilla/5.0 Windows Chrome",
            
        
    
        
        
            
                "occurred_at": new Date('2026-06-01T13:25:00Z'),
            
        
    
    },
    
];



const WebhookEndpointsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Payments Webhook",
            
        
    
        
        
            
                "url": "https://hooks.entangle.example/stripe",
            
        
    
        
        
            
                "secret": "whsec_2c9b1e19c8d2",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "verify_signature": true,
            
        
    
        
        
            
                "last_success_at": new Date('2026-06-02T15:13:10Z'),
            
        
    
        
        
            
                "last_failure_at": new Date('2026-06-10T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Partner Events Webhook",
            
        
    
        
        
            
                "url": "https://api.willowco.example/webhooks/entangle",
            
        
    
        
        
            
                "secret": "whsec_8b1d4f0d77a3",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "verify_signature": true,
            
        
    
        
        
            
                "last_success_at": new Date('2026-06-01T18:05:10Z'),
            
        
    
        
        
            
                "last_failure_at": new Date('2026-06-10T00:00:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Status Updates Webhook",
            
        
    
        
        
            
                "url": "https://northshore.example/hooks/status",
            
        
    
        
        
            
                "secret": "whsec_19aa2e9d6c31",
            
        
    
        
        
            
                "status": "disabled",
            
        
    
        
        
            
                "verify_signature": true,
            
        
    
        
        
            
                "last_success_at": new Date('2026-05-20T10:00:00Z'),
            
        
    
        
        
            
                "last_failure_at": new Date('2026-06-01T13:50:00Z'),
            
        
    
    },
    
];



const WebhookDeliveriesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_key": "payment_succeeded",
            
        
    
        
        
            
                "payload_json": "{event:payment_succeeded,reference:pi_3NXX02essential,amount:129,currency:USD}",
            
        
    
        
        
            
                "status": "pending",
            
        
    
        
        
            
                "attempt_count": 1,
            
        
    
        
        
            
                "delivered_at": new Date('2026-06-02T15:13:10Z'),
            
        
    
        
        
            
                "next_retry_at": new Date('2026-06-10T00:00:00Z'),
            
        
    
        
        
            
                "last_error": "none",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_key": "request_created",
            
        
    
        
        
            
                "payload_json": "{event:request_created,summary:Coordinate property access with vendor,status:coordinator_assigned}",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "attempt_count": 1,
            
        
    
        
        
            
                "delivered_at": new Date('2026-06-01T18:05:10Z'),
            
        
    
        
        
            
                "next_retry_at": new Date('2026-06-10T00:00:00Z'),
            
        
    
        
        
            
                "last_error": "none",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_key": "status_change",
            
        
    
        
        
            
                "payload_json": "{event:status_change,summary:Retrieve signed documents from office,status:in_progress}",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "attempt_count": 3,
            
        
    
        
        
            
                "delivered_at": new Date('2026-06-01T14:06:00Z'),
            
        
    
        
        
            
                "next_retry_at": new Date('2026-06-01T14:36:00Z'),
            
        
    
        
        
            
                "last_error": "HTTP 410 endpoint disabled",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CsvJobsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "job_type": "export",
            
        
    
        
        
            
                "resource": "payments",
            
        
    
        
        
            
                "status": "processing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "records_total": 120,
            
        
    
        
        
            
                "records_succeeded": 118,
            
        
    
        
        
            
                "records_failed": 2,
            
        
    
        
        
            
                "error_report": "2 records failed due to invalid phone format.",
            
        
    
        
        
            
                "started_at": new Date('2026-05-15T16:00:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-05-15T16:02:30Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "job_type": "export",
            
        
    
        
        
            
                "resource": "support_tickets",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "records_total": 342,
            
        
    
        
        
            
                "records_succeeded": 342,
            
        
    
        
        
            
                "records_failed": 0,
            
        
    
        
        
            
                "error_report": "Export completed successfully.",
            
        
    
        
        
            
                "started_at": new Date('2026-06-01T08:00:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-06-01T08:01:10Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "job_type": "export",
            
        
    
        
        
            
                "resource": "customers",
            
        
    
        
        
            
                "status": "processing",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "records_total": 45,
            
        
    
        
        
            
                "records_succeeded": 0,
            
        
    
        
        
            
                "records_failed": 0,
            
        
    
        
        
            
                "error_report": "Job is running.",
            
        
    
        
        
            
                "started_at": new Date('2026-06-02T12:30:00Z'),
            
        
    
        
        
            
                "finished_at": new Date('2026-06-10T00:00:00Z'),
            
        
    
    },
    
];



const UsageEventsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_name": "invoice_paid",
            
        
    
        
        
            
                "metadata_json": "{method:email,device:web}",
            
        
    
        
        
            
                "occurred_at": new Date('2026-05-27T19:05:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_name": "login",
            
        
    
        
        
            
                "metadata_json": "{service_type:retrieval,timing:scheduled}",
            
        
    
        
        
            
                "occurred_at": new Date('2026-06-01T13:20:00Z'),
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_name": "invoice_paid",
            
        
    
        
        
            
                "metadata_json": "{thread:Retrieval coordination updates}",
            
        
    
        
        
            
                "occurred_at": new Date('2026-06-01T14:00:00Z'),
            
        
    
    },
    
];




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // 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);
                }
            
        }
        
    

    
    
    
    
    
        
    

    
    
    
        
            
            async function associateOrganizationInvitationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OrganizationInvitation0 = await OrganizationInvitations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (OrganizationInvitation0?.setOrganization)
                {
                    await
                    OrganizationInvitation0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OrganizationInvitation1 = await OrganizationInvitations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (OrganizationInvitation1?.setOrganization)
                {
                    await
                    OrganizationInvitation1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const OrganizationInvitation2 = await OrganizationInvitations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (OrganizationInvitation2?.setOrganization)
                {
                    await
                    OrganizationInvitation2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            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);
                }
            
        }
        
    
        
            
            async function associateCustomerWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Customer0 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Customer0?.setUser)
                {
                    await
                    Customer0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Customer1 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Customer1?.setUser)
                {
                    await
                    Customer1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Customer2 = await Customers.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Customer2?.setUser)
                {
                    await
                    Customer2.
                    setUser(relatedUser2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateSavedAddressWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const SavedAddress0 = await SavedAddresses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SavedAddress0?.setCustomer)
                {
                    await
                    SavedAddress0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const SavedAddress1 = await SavedAddresses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SavedAddress1?.setCustomer)
                {
                    await
                    SavedAddress1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const SavedAddress2 = await SavedAddresses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SavedAddress2?.setCustomer)
                {
                    await
                    SavedAddress2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateSavedAddressWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SavedAddress0 = await SavedAddresses.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SavedAddress0?.setOrganization)
                {
                    await
                    SavedAddress0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SavedAddress1 = await SavedAddresses.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SavedAddress1?.setOrganization)
                {
                    await
                    SavedAddress1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SavedAddress2 = await SavedAddresses.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SavedAddress2?.setOrganization)
                {
                    await
                    SavedAddress2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateServicePackageWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ServicePackage0 = await ServicePackages.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ServicePackage0?.setOrganization)
                {
                    await
                    ServicePackage0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ServicePackage1 = await ServicePackages.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ServicePackage1?.setOrganization)
                {
                    await
                    ServicePackage1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ServicePackage2 = await ServicePackages.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ServicePackage2?.setOrganization)
                {
                    await
                    ServicePackage2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateServiceAddOnWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ServiceAddOn0 = await ServiceAddOns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ServiceAddOn0?.setOrganization)
                {
                    await
                    ServiceAddOn0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ServiceAddOn1 = await ServiceAddOns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ServiceAddOn1?.setOrganization)
                {
                    await
                    ServiceAddOn1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ServiceAddOn2 = await ServiceAddOns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ServiceAddOn2?.setOrganization)
                {
                    await
                    ServiceAddOn2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateServiceRequestWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ServiceRequest0 = await ServiceRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ServiceRequest0?.setOrganization)
                {
                    await
                    ServiceRequest0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ServiceRequest1 = await ServiceRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ServiceRequest1?.setOrganization)
                {
                    await
                    ServiceRequest1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ServiceRequest2 = await ServiceRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ServiceRequest2?.setOrganization)
                {
                    await
                    ServiceRequest2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
            
            async function associateServiceRequestWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const ServiceRequest0 = await ServiceRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ServiceRequest0?.setCustomer)
                {
                    await
                    ServiceRequest0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const ServiceRequest1 = await ServiceRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ServiceRequest1?.setCustomer)
                {
                    await
                    ServiceRequest1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const ServiceRequest2 = await ServiceRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ServiceRequest2?.setCustomer)
                {
                    await
                    ServiceRequest2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
            
            async function associateServiceRequestWithRequester_user() {
            
                const relatedRequester_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ServiceRequest0 = await ServiceRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ServiceRequest0?.setRequester_user)
                {
                    await
                    ServiceRequest0.
                    setRequester_user(relatedRequester_user0);
                }
            
                const relatedRequester_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ServiceRequest1 = await ServiceRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ServiceRequest1?.setRequester_user)
                {
                    await
                    ServiceRequest1.
                    setRequester_user(relatedRequester_user1);
                }
            
                const relatedRequester_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ServiceRequest2 = await ServiceRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ServiceRequest2?.setRequester_user)
                {
                    await
                    ServiceRequest2.
                    setRequester_user(relatedRequester_user2);
                }
            
        }
        
    
        
            
            async function associateServiceRequestWithAssigned_coordinator_user() {
            
                const relatedAssigned_coordinator_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ServiceRequest0 = await ServiceRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ServiceRequest0?.setAssigned_coordinator_user)
                {
                    await
                    ServiceRequest0.
                    setAssigned_coordinator_user(relatedAssigned_coordinator_user0);
                }
            
                const relatedAssigned_coordinator_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ServiceRequest1 = await ServiceRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ServiceRequest1?.setAssigned_coordinator_user)
                {
                    await
                    ServiceRequest1.
                    setAssigned_coordinator_user(relatedAssigned_coordinator_user1);
                }
            
                const relatedAssigned_coordinator_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ServiceRequest2 = await ServiceRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ServiceRequest2?.setAssigned_coordinator_user)
                {
                    await
                    ServiceRequest2.
                    setAssigned_coordinator_user(relatedAssigned_coordinator_user2);
                }
            
        }
        
    
        
            
            async function associateServiceRequestWithService_package() {
            
                const relatedService_package0 = await ServicePackages.findOne({
                    offset: Math.floor(Math.random() * (await ServicePackages.count())),
                });
                const ServiceRequest0 = await ServiceRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ServiceRequest0?.setService_package)
                {
                    await
                    ServiceRequest0.
                    setService_package(relatedService_package0);
                }
            
                const relatedService_package1 = await ServicePackages.findOne({
                    offset: Math.floor(Math.random() * (await ServicePackages.count())),
                });
                const ServiceRequest1 = await ServiceRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ServiceRequest1?.setService_package)
                {
                    await
                    ServiceRequest1.
                    setService_package(relatedService_package1);
                }
            
                const relatedService_package2 = await ServicePackages.findOne({
                    offset: Math.floor(Math.random() * (await ServicePackages.count())),
                });
                const ServiceRequest2 = await ServiceRequests.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ServiceRequest2?.setService_package)
                {
                    await
                    ServiceRequest2.
                    setService_package(relatedService_package2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateServiceRequestAddOnWithService_request() {
            
                const relatedService_request0 = await ServiceRequests.findOne({
                    offset: Math.floor(Math.random() * (await ServiceRequests.count())),
                });
                const ServiceRequestAddOn0 = await ServiceRequestAddOns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ServiceRequestAddOn0?.setService_request)
                {
                    await
                    ServiceRequestAddOn0.
                    setService_request(relatedService_request0);
                }
            
                const relatedService_request1 = await ServiceRequests.findOne({
                    offset: Math.floor(Math.random() * (await ServiceRequests.count())),
                });
                const ServiceRequestAddOn1 = await ServiceRequestAddOns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ServiceRequestAddOn1?.setService_request)
                {
                    await
                    ServiceRequestAddOn1.
                    setService_request(relatedService_request1);
                }
            
                const relatedService_request2 = await ServiceRequests.findOne({
                    offset: Math.floor(Math.random() * (await ServiceRequests.count())),
                });
                const ServiceRequestAddOn2 = await ServiceRequestAddOns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ServiceRequestAddOn2?.setService_request)
                {
                    await
                    ServiceRequestAddOn2.
                    setService_request(relatedService_request2);
                }
            
        }
        
    
        
            
            async function associateServiceRequestAddOnWithService_add_on() {
            
                const relatedService_add_on0 = await ServiceAddOns.findOne({
                    offset: Math.floor(Math.random() * (await ServiceAddOns.count())),
                });
                const ServiceRequestAddOn0 = await ServiceRequestAddOns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ServiceRequestAddOn0?.setService_add_on)
                {
                    await
                    ServiceRequestAddOn0.
                    setService_add_on(relatedService_add_on0);
                }
            
                const relatedService_add_on1 = await ServiceAddOns.findOne({
                    offset: Math.floor(Math.random() * (await ServiceAddOns.count())),
                });
                const ServiceRequestAddOn1 = await ServiceRequestAddOns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ServiceRequestAddOn1?.setService_add_on)
                {
                    await
                    ServiceRequestAddOn1.
                    setService_add_on(relatedService_add_on1);
                }
            
                const relatedService_add_on2 = await ServiceAddOns.findOne({
                    offset: Math.floor(Math.random() * (await ServiceAddOns.count())),
                });
                const ServiceRequestAddOn2 = await ServiceRequestAddOns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ServiceRequestAddOn2?.setService_add_on)
                {
                    await
                    ServiceRequestAddOn2.
                    setService_add_on(relatedService_add_on2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateServiceRequestAddOnWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ServiceRequestAddOn0 = await ServiceRequestAddOns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ServiceRequestAddOn0?.setOrganization)
                {
                    await
                    ServiceRequestAddOn0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ServiceRequestAddOn1 = await ServiceRequestAddOns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ServiceRequestAddOn1?.setOrganization)
                {
                    await
                    ServiceRequestAddOn1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ServiceRequestAddOn2 = await ServiceRequestAddOns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ServiceRequestAddOn2?.setOrganization)
                {
                    await
                    ServiceRequestAddOn2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateRequestChecklistItemWithService_request() {
            
                const relatedService_request0 = await ServiceRequests.findOne({
                    offset: Math.floor(Math.random() * (await ServiceRequests.count())),
                });
                const RequestChecklistItem0 = await RequestChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RequestChecklistItem0?.setService_request)
                {
                    await
                    RequestChecklistItem0.
                    setService_request(relatedService_request0);
                }
            
                const relatedService_request1 = await ServiceRequests.findOne({
                    offset: Math.floor(Math.random() * (await ServiceRequests.count())),
                });
                const RequestChecklistItem1 = await RequestChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RequestChecklistItem1?.setService_request)
                {
                    await
                    RequestChecklistItem1.
                    setService_request(relatedService_request1);
                }
            
                const relatedService_request2 = await ServiceRequests.findOne({
                    offset: Math.floor(Math.random() * (await ServiceRequests.count())),
                });
                const RequestChecklistItem2 = await RequestChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RequestChecklistItem2?.setService_request)
                {
                    await
                    RequestChecklistItem2.
                    setService_request(relatedService_request2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateRequestChecklistItemWithAssigned_user() {
            
                const relatedAssigned_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RequestChecklistItem0 = await RequestChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RequestChecklistItem0?.setAssigned_user)
                {
                    await
                    RequestChecklistItem0.
                    setAssigned_user(relatedAssigned_user0);
                }
            
                const relatedAssigned_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RequestChecklistItem1 = await RequestChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RequestChecklistItem1?.setAssigned_user)
                {
                    await
                    RequestChecklistItem1.
                    setAssigned_user(relatedAssigned_user1);
                }
            
                const relatedAssigned_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RequestChecklistItem2 = await RequestChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RequestChecklistItem2?.setAssigned_user)
                {
                    await
                    RequestChecklistItem2.
                    setAssigned_user(relatedAssigned_user2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateRequestChecklistItemWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RequestChecklistItem0 = await RequestChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RequestChecklistItem0?.setOrganization)
                {
                    await
                    RequestChecklistItem0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RequestChecklistItem1 = await RequestChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RequestChecklistItem1?.setOrganization)
                {
                    await
                    RequestChecklistItem1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RequestChecklistItem2 = await RequestChecklistItems.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RequestChecklistItem2?.setOrganization)
                {
                    await
                    RequestChecklistItem2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateRequestTimelineEventWithService_request() {
            
                const relatedService_request0 = await ServiceRequests.findOne({
                    offset: Math.floor(Math.random() * (await ServiceRequests.count())),
                });
                const RequestTimelineEvent0 = await RequestTimelineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RequestTimelineEvent0?.setService_request)
                {
                    await
                    RequestTimelineEvent0.
                    setService_request(relatedService_request0);
                }
            
                const relatedService_request1 = await ServiceRequests.findOne({
                    offset: Math.floor(Math.random() * (await ServiceRequests.count())),
                });
                const RequestTimelineEvent1 = await RequestTimelineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RequestTimelineEvent1?.setService_request)
                {
                    await
                    RequestTimelineEvent1.
                    setService_request(relatedService_request1);
                }
            
                const relatedService_request2 = await ServiceRequests.findOne({
                    offset: Math.floor(Math.random() * (await ServiceRequests.count())),
                });
                const RequestTimelineEvent2 = await RequestTimelineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RequestTimelineEvent2?.setService_request)
                {
                    await
                    RequestTimelineEvent2.
                    setService_request(relatedService_request2);
                }
            
        }
        
    
        
            
            async function associateRequestTimelineEventWithActor_user() {
            
                const relatedActor_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RequestTimelineEvent0 = await RequestTimelineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RequestTimelineEvent0?.setActor_user)
                {
                    await
                    RequestTimelineEvent0.
                    setActor_user(relatedActor_user0);
                }
            
                const relatedActor_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RequestTimelineEvent1 = await RequestTimelineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RequestTimelineEvent1?.setActor_user)
                {
                    await
                    RequestTimelineEvent1.
                    setActor_user(relatedActor_user1);
                }
            
                const relatedActor_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RequestTimelineEvent2 = await RequestTimelineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RequestTimelineEvent2?.setActor_user)
                {
                    await
                    RequestTimelineEvent2.
                    setActor_user(relatedActor_user2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateRequestTimelineEventWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RequestTimelineEvent0 = await RequestTimelineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RequestTimelineEvent0?.setOrganization)
                {
                    await
                    RequestTimelineEvent0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RequestTimelineEvent1 = await RequestTimelineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RequestTimelineEvent1?.setOrganization)
                {
                    await
                    RequestTimelineEvent1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RequestTimelineEvent2 = await RequestTimelineEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RequestTimelineEvent2?.setOrganization)
                {
                    await
                    RequestTimelineEvent2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateRequestDocumentWithService_request() {
            
                const relatedService_request0 = await ServiceRequests.findOne({
                    offset: Math.floor(Math.random() * (await ServiceRequests.count())),
                });
                const RequestDocument0 = await RequestDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RequestDocument0?.setService_request)
                {
                    await
                    RequestDocument0.
                    setService_request(relatedService_request0);
                }
            
                const relatedService_request1 = await ServiceRequests.findOne({
                    offset: Math.floor(Math.random() * (await ServiceRequests.count())),
                });
                const RequestDocument1 = await RequestDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RequestDocument1?.setService_request)
                {
                    await
                    RequestDocument1.
                    setService_request(relatedService_request1);
                }
            
                const relatedService_request2 = await ServiceRequests.findOne({
                    offset: Math.floor(Math.random() * (await ServiceRequests.count())),
                });
                const RequestDocument2 = await RequestDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RequestDocument2?.setService_request)
                {
                    await
                    RequestDocument2.
                    setService_request(relatedService_request2);
                }
            
        }
        
    
        
            
            async function associateRequestDocumentWithUploaded_by_user() {
            
                const relatedUploaded_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RequestDocument0 = await RequestDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RequestDocument0?.setUploaded_by_user)
                {
                    await
                    RequestDocument0.
                    setUploaded_by_user(relatedUploaded_by_user0);
                }
            
                const relatedUploaded_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RequestDocument1 = await RequestDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RequestDocument1?.setUploaded_by_user)
                {
                    await
                    RequestDocument1.
                    setUploaded_by_user(relatedUploaded_by_user1);
                }
            
                const relatedUploaded_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const RequestDocument2 = await RequestDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RequestDocument2?.setUploaded_by_user)
                {
                    await
                    RequestDocument2.
                    setUploaded_by_user(relatedUploaded_by_user2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateRequestDocumentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RequestDocument0 = await RequestDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RequestDocument0?.setOrganization)
                {
                    await
                    RequestDocument0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RequestDocument1 = await RequestDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RequestDocument1?.setOrganization)
                {
                    await
                    RequestDocument1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RequestDocument2 = await RequestDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RequestDocument2?.setOrganization)
                {
                    await
                    RequestDocument2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateChatThreadWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ChatThread0 = await ChatThreads.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ChatThread0?.setOrganization)
                {
                    await
                    ChatThread0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ChatThread1 = await ChatThreads.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ChatThread1?.setOrganization)
                {
                    await
                    ChatThread1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ChatThread2 = await ChatThreads.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ChatThread2?.setOrganization)
                {
                    await
                    ChatThread2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
            
            async function associateChatThreadWithService_request() {
            
                const relatedService_request0 = await ServiceRequests.findOne({
                    offset: Math.floor(Math.random() * (await ServiceRequests.count())),
                });
                const ChatThread0 = await ChatThreads.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ChatThread0?.setService_request)
                {
                    await
                    ChatThread0.
                    setService_request(relatedService_request0);
                }
            
                const relatedService_request1 = await ServiceRequests.findOne({
                    offset: Math.floor(Math.random() * (await ServiceRequests.count())),
                });
                const ChatThread1 = await ChatThreads.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ChatThread1?.setService_request)
                {
                    await
                    ChatThread1.
                    setService_request(relatedService_request1);
                }
            
                const relatedService_request2 = await ServiceRequests.findOne({
                    offset: Math.floor(Math.random() * (await ServiceRequests.count())),
                });
                const ChatThread2 = await ChatThreads.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ChatThread2?.setService_request)
                {
                    await
                    ChatThread2.
                    setService_request(relatedService_request2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateChatMessageWithChat_thread() {
            
                const relatedChat_thread0 = await ChatThreads.findOne({
                    offset: Math.floor(Math.random() * (await ChatThreads.count())),
                });
                const ChatMessage0 = await ChatMessages.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ChatMessage0?.setChat_thread)
                {
                    await
                    ChatMessage0.
                    setChat_thread(relatedChat_thread0);
                }
            
                const relatedChat_thread1 = await ChatThreads.findOne({
                    offset: Math.floor(Math.random() * (await ChatThreads.count())),
                });
                const ChatMessage1 = await ChatMessages.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ChatMessage1?.setChat_thread)
                {
                    await
                    ChatMessage1.
                    setChat_thread(relatedChat_thread1);
                }
            
                const relatedChat_thread2 = await ChatThreads.findOne({
                    offset: Math.floor(Math.random() * (await ChatThreads.count())),
                });
                const ChatMessage2 = await ChatMessages.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ChatMessage2?.setChat_thread)
                {
                    await
                    ChatMessage2.
                    setChat_thread(relatedChat_thread2);
                }
            
        }
        
    
        
            
            async function associateChatMessageWithSender_user() {
            
                const relatedSender_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ChatMessage0 = await ChatMessages.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ChatMessage0?.setSender_user)
                {
                    await
                    ChatMessage0.
                    setSender_user(relatedSender_user0);
                }
            
                const relatedSender_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ChatMessage1 = await ChatMessages.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ChatMessage1?.setSender_user)
                {
                    await
                    ChatMessage1.
                    setSender_user(relatedSender_user1);
                }
            
                const relatedSender_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ChatMessage2 = await ChatMessages.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ChatMessage2?.setSender_user)
                {
                    await
                    ChatMessage2.
                    setSender_user(relatedSender_user2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateChatMessageWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ChatMessage0 = await ChatMessages.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ChatMessage0?.setOrganization)
                {
                    await
                    ChatMessage0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ChatMessage1 = await ChatMessages.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ChatMessage1?.setOrganization)
                {
                    await
                    ChatMessage1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ChatMessage2 = await ChatMessages.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ChatMessage2?.setOrganization)
                {
                    await
                    ChatMessage2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePaymentTransactionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PaymentTransaction0 = await PaymentTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PaymentTransaction0?.setOrganization)
                {
                    await
                    PaymentTransaction0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PaymentTransaction1 = await PaymentTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PaymentTransaction1?.setOrganization)
                {
                    await
                    PaymentTransaction1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const PaymentTransaction2 = await PaymentTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PaymentTransaction2?.setOrganization)
                {
                    await
                    PaymentTransaction2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
            
            async function associatePaymentTransactionWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const PaymentTransaction0 = await PaymentTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PaymentTransaction0?.setCustomer)
                {
                    await
                    PaymentTransaction0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const PaymentTransaction1 = await PaymentTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PaymentTransaction1?.setCustomer)
                {
                    await
                    PaymentTransaction1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const PaymentTransaction2 = await PaymentTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PaymentTransaction2?.setCustomer)
                {
                    await
                    PaymentTransaction2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
            
            async function associatePaymentTransactionWithService_request() {
            
                const relatedService_request0 = await ServiceRequests.findOne({
                    offset: Math.floor(Math.random() * (await ServiceRequests.count())),
                });
                const PaymentTransaction0 = await PaymentTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (PaymentTransaction0?.setService_request)
                {
                    await
                    PaymentTransaction0.
                    setService_request(relatedService_request0);
                }
            
                const relatedService_request1 = await ServiceRequests.findOne({
                    offset: Math.floor(Math.random() * (await ServiceRequests.count())),
                });
                const PaymentTransaction1 = await PaymentTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (PaymentTransaction1?.setService_request)
                {
                    await
                    PaymentTransaction1.
                    setService_request(relatedService_request1);
                }
            
                const relatedService_request2 = await ServiceRequests.findOne({
                    offset: Math.floor(Math.random() * (await ServiceRequests.count())),
                });
                const PaymentTransaction2 = await PaymentTransactions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (PaymentTransaction2?.setService_request)
                {
                    await
                    PaymentTransaction2.
                    setService_request(relatedService_request2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            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);
                }
            
        }
        
    
        
            
            async function associateInvoiceWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Invoice0 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Invoice0?.setCustomer)
                {
                    await
                    Invoice0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Invoice1 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Invoice1?.setCustomer)
                {
                    await
                    Invoice1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Invoice2 = await Invoices.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Invoice2?.setCustomer)
                {
                    await
                    Invoice2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateSubscriptionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Subscription0 = await Subscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Subscription0?.setOrganization)
                {
                    await
                    Subscription0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Subscription1 = await Subscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Subscription1?.setOrganization)
                {
                    await
                    Subscription1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Subscription2 = await Subscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Subscription2?.setOrganization)
                {
                    await
                    Subscription2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
            
            async function associateSubscriptionWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Subscription0 = await Subscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Subscription0?.setCustomer)
                {
                    await
                    Subscription0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Subscription1 = await Subscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Subscription1?.setCustomer)
                {
                    await
                    Subscription1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const Subscription2 = await Subscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Subscription2?.setCustomer)
                {
                    await
                    Subscription2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
            
            async function associateSubscriptionWithService_package() {
            
                const relatedService_package0 = await ServicePackages.findOne({
                    offset: Math.floor(Math.random() * (await ServicePackages.count())),
                });
                const Subscription0 = await Subscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Subscription0?.setService_package)
                {
                    await
                    Subscription0.
                    setService_package(relatedService_package0);
                }
            
                const relatedService_package1 = await ServicePackages.findOne({
                    offset: Math.floor(Math.random() * (await ServicePackages.count())),
                });
                const Subscription1 = await Subscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Subscription1?.setService_package)
                {
                    await
                    Subscription1.
                    setService_package(relatedService_package1);
                }
            
                const relatedService_package2 = await ServicePackages.findOne({
                    offset: Math.floor(Math.random() * (await ServicePackages.count())),
                });
                const Subscription2 = await Subscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Subscription2?.setService_package)
                {
                    await
                    Subscription2.
                    setService_package(relatedService_package2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateLegalDocumentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const LegalDocument0 = await LegalDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (LegalDocument0?.setOrganization)
                {
                    await
                    LegalDocument0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const LegalDocument1 = await LegalDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (LegalDocument1?.setOrganization)
                {
                    await
                    LegalDocument1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const LegalDocument2 = await LegalDocuments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (LegalDocument2?.setOrganization)
                {
                    await
                    LegalDocument2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateDocumentAcceptanceWithLegal_document() {
            
                const relatedLegal_document0 = await LegalDocuments.findOne({
                    offset: Math.floor(Math.random() * (await LegalDocuments.count())),
                });
                const DocumentAcceptance0 = await DocumentAcceptances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DocumentAcceptance0?.setLegal_document)
                {
                    await
                    DocumentAcceptance0.
                    setLegal_document(relatedLegal_document0);
                }
            
                const relatedLegal_document1 = await LegalDocuments.findOne({
                    offset: Math.floor(Math.random() * (await LegalDocuments.count())),
                });
                const DocumentAcceptance1 = await DocumentAcceptances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DocumentAcceptance1?.setLegal_document)
                {
                    await
                    DocumentAcceptance1.
                    setLegal_document(relatedLegal_document1);
                }
            
                const relatedLegal_document2 = await LegalDocuments.findOne({
                    offset: Math.floor(Math.random() * (await LegalDocuments.count())),
                });
                const DocumentAcceptance2 = await DocumentAcceptances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DocumentAcceptance2?.setLegal_document)
                {
                    await
                    DocumentAcceptance2.
                    setLegal_document(relatedLegal_document2);
                }
            
        }
        
    
        
            
            async function associateDocumentAcceptanceWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const DocumentAcceptance0 = await DocumentAcceptances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DocumentAcceptance0?.setUser)
                {
                    await
                    DocumentAcceptance0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const DocumentAcceptance1 = await DocumentAcceptances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DocumentAcceptance1?.setUser)
                {
                    await
                    DocumentAcceptance1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const DocumentAcceptance2 = await DocumentAcceptances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DocumentAcceptance2?.setUser)
                {
                    await
                    DocumentAcceptance2.
                    setUser(relatedUser2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateDocumentAcceptanceWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DocumentAcceptance0 = await DocumentAcceptances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DocumentAcceptance0?.setOrganization)
                {
                    await
                    DocumentAcceptance0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DocumentAcceptance1 = await DocumentAcceptances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DocumentAcceptance1?.setOrganization)
                {
                    await
                    DocumentAcceptance1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DocumentAcceptance2 = await DocumentAcceptances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DocumentAcceptance2?.setOrganization)
                {
                    await
                    DocumentAcceptance2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateSupportTicketWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SupportTicket0 = await SupportTickets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SupportTicket0?.setOrganization)
                {
                    await
                    SupportTicket0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SupportTicket1 = await SupportTickets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SupportTicket1?.setOrganization)
                {
                    await
                    SupportTicket1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SupportTicket2 = await SupportTickets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SupportTicket2?.setOrganization)
                {
                    await
                    SupportTicket2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
            
            async function associateSupportTicketWithCustomer() {
            
                const relatedCustomer0 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const SupportTicket0 = await SupportTickets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SupportTicket0?.setCustomer)
                {
                    await
                    SupportTicket0.
                    setCustomer(relatedCustomer0);
                }
            
                const relatedCustomer1 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const SupportTicket1 = await SupportTickets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SupportTicket1?.setCustomer)
                {
                    await
                    SupportTicket1.
                    setCustomer(relatedCustomer1);
                }
            
                const relatedCustomer2 = await Customers.findOne({
                    offset: Math.floor(Math.random() * (await Customers.count())),
                });
                const SupportTicket2 = await SupportTickets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SupportTicket2?.setCustomer)
                {
                    await
                    SupportTicket2.
                    setCustomer(relatedCustomer2);
                }
            
        }
        
    
        
            
            async function associateSupportTicketWithAssigned_admin_user() {
            
                const relatedAssigned_admin_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SupportTicket0 = await SupportTickets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SupportTicket0?.setAssigned_admin_user)
                {
                    await
                    SupportTicket0.
                    setAssigned_admin_user(relatedAssigned_admin_user0);
                }
            
                const relatedAssigned_admin_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SupportTicket1 = await SupportTickets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SupportTicket1?.setAssigned_admin_user)
                {
                    await
                    SupportTicket1.
                    setAssigned_admin_user(relatedAssigned_admin_user1);
                }
            
                const relatedAssigned_admin_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SupportTicket2 = await SupportTickets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SupportTicket2?.setAssigned_admin_user)
                {
                    await
                    SupportTicket2.
                    setAssigned_admin_user(relatedAssigned_admin_user2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateLeadWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Lead0 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lead0?.setOrganization)
                {
                    await
                    Lead0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Lead1 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lead1?.setOrganization)
                {
                    await
                    Lead1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Lead2 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lead2?.setOrganization)
                {
                    await
                    Lead2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateLeadWithOwner_user() {
            
                const relatedOwner_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Lead0 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Lead0?.setOwner_user)
                {
                    await
                    Lead0.
                    setOwner_user(relatedOwner_user0);
                }
            
                const relatedOwner_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Lead1 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Lead1?.setOwner_user)
                {
                    await
                    Lead1.
                    setOwner_user(relatedOwner_user1);
                }
            
                const relatedOwner_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Lead2 = await Leads.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Lead2?.setOwner_user)
                {
                    await
                    Lead2.
                    setOwner_user(relatedOwner_user2);
                }
            
        }
        
    
        
    

    
    
    
        
            
            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);
                }
            
        }
        
    
        
            
            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);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateAuditLogWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditLog0 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditLog0?.setOrganization)
                {
                    await
                    AuditLog0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditLog1 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditLog1?.setOrganization)
                {
                    await
                    AuditLog1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AuditLog2 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditLog2?.setOrganization)
                {
                    await
                    AuditLog2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
            
            async function associateAuditLogWithActor_user() {
            
                const relatedActor_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog0 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditLog0?.setActor_user)
                {
                    await
                    AuditLog0.
                    setActor_user(relatedActor_user0);
                }
            
                const relatedActor_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog1 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditLog1?.setActor_user)
                {
                    await
                    AuditLog1.
                    setActor_user(relatedActor_user1);
                }
            
                const relatedActor_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AuditLog2 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditLog2?.setActor_user)
                {
                    await
                    AuditLog2.
                    setActor_user(relatedActor_user2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateWebhookEndpointWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WebhookEndpoint0 = await WebhookEndpoints.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WebhookEndpoint0?.setOrganization)
                {
                    await
                    WebhookEndpoint0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WebhookEndpoint1 = await WebhookEndpoints.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WebhookEndpoint1?.setOrganization)
                {
                    await
                    WebhookEndpoint1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WebhookEndpoint2 = await WebhookEndpoints.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WebhookEndpoint2?.setOrganization)
                {
                    await
                    WebhookEndpoint2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateWebhookDeliveryWithWebhook_endpoint() {
            
                const relatedWebhook_endpoint0 = await WebhookEndpoints.findOne({
                    offset: Math.floor(Math.random() * (await WebhookEndpoints.count())),
                });
                const WebhookDelivery0 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WebhookDelivery0?.setWebhook_endpoint)
                {
                    await
                    WebhookDelivery0.
                    setWebhook_endpoint(relatedWebhook_endpoint0);
                }
            
                const relatedWebhook_endpoint1 = await WebhookEndpoints.findOne({
                    offset: Math.floor(Math.random() * (await WebhookEndpoints.count())),
                });
                const WebhookDelivery1 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WebhookDelivery1?.setWebhook_endpoint)
                {
                    await
                    WebhookDelivery1.
                    setWebhook_endpoint(relatedWebhook_endpoint1);
                }
            
                const relatedWebhook_endpoint2 = await WebhookEndpoints.findOne({
                    offset: Math.floor(Math.random() * (await WebhookEndpoints.count())),
                });
                const WebhookDelivery2 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WebhookDelivery2?.setWebhook_endpoint)
                {
                    await
                    WebhookDelivery2.
                    setWebhook_endpoint(relatedWebhook_endpoint2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateWebhookDeliveryWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WebhookDelivery0 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (WebhookDelivery0?.setOrganization)
                {
                    await
                    WebhookDelivery0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WebhookDelivery1 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (WebhookDelivery1?.setOrganization)
                {
                    await
                    WebhookDelivery1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const WebhookDelivery2 = await WebhookDeliveries.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (WebhookDelivery2?.setOrganization)
                {
                    await
                    WebhookDelivery2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCsvJobWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CsvJob0 = await CsvJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CsvJob0?.setOrganization)
                {
                    await
                    CsvJob0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CsvJob1 = await CsvJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CsvJob1?.setOrganization)
                {
                    await
                    CsvJob1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CsvJob2 = await CsvJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CsvJob2?.setOrganization)
                {
                    await
                    CsvJob2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
            
            async function associateCsvJobWithRequested_by_user() {
            
                const relatedRequested_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CsvJob0 = await CsvJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CsvJob0?.setRequested_by_user)
                {
                    await
                    CsvJob0.
                    setRequested_by_user(relatedRequested_by_user0);
                }
            
                const relatedRequested_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CsvJob1 = await CsvJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CsvJob1?.setRequested_by_user)
                {
                    await
                    CsvJob1.
                    setRequested_by_user(relatedRequested_by_user1);
                }
            
                const relatedRequested_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CsvJob2 = await CsvJobs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CsvJob2?.setRequested_by_user)
                {
                    await
                    CsvJob2.
                    setRequested_by_user(relatedRequested_by_user2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateUsageEventWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const UsageEvent0 = await UsageEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (UsageEvent0?.setOrganization)
                {
                    await
                    UsageEvent0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const UsageEvent1 = await UsageEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (UsageEvent1?.setOrganization)
                {
                    await
                    UsageEvent1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const UsageEvent2 = await UsageEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (UsageEvent2?.setOrganization)
                {
                    await
                    UsageEvent2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
            
            async function associateUsageEventWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const UsageEvent0 = await UsageEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (UsageEvent0?.setUser)
                {
                    await
                    UsageEvent0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const UsageEvent1 = await UsageEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (UsageEvent1?.setUser)
                {
                    await
                    UsageEvent1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const UsageEvent2 = await UsageEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (UsageEvent2?.setUser)
                {
                    await
                    UsageEvent2.
                    setUser(relatedUser2);
                }
            
        }
        
    
        
    
        
    
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Organizations.bulkCreate(OrganizationsData);
                
            
            
                
                await OrganizationInvitations.bulkCreate(OrganizationInvitationsData);
                
            
            
                
                await Customers.bulkCreate(CustomersData);
                
            
            
                
                await SavedAddresses.bulkCreate(SavedAddressesData);
                
            
            
                
                await ServicePackages.bulkCreate(ServicePackagesData);
                
            
            
                
                await ServiceAddOns.bulkCreate(ServiceAddOnsData);
                
            
            
                
                await ServiceRequests.bulkCreate(ServiceRequestsData);
                
            
            
                
                await ServiceRequestAddOns.bulkCreate(ServiceRequestAddOnsData);
                
            
            
                
                await RequestChecklistItems.bulkCreate(RequestChecklistItemsData);
                
            
            
                
                await RequestTimelineEvents.bulkCreate(RequestTimelineEventsData);
                
            
            
                
                await RequestDocuments.bulkCreate(RequestDocumentsData);
                
            
            
                
                await ChatThreads.bulkCreate(ChatThreadsData);
                
            
            
                
                await ChatMessages.bulkCreate(ChatMessagesData);
                
            
            
                
                await PaymentTransactions.bulkCreate(PaymentTransactionsData);
                
            
            
                
                await Invoices.bulkCreate(InvoicesData);
                
            
            
                
                await Subscriptions.bulkCreate(SubscriptionsData);
                
            
            
                
                await LegalDocuments.bulkCreate(LegalDocumentsData);
                
            
            
                
                await DocumentAcceptances.bulkCreate(DocumentAcceptancesData);
                
            
            
                
                await SupportTickets.bulkCreate(SupportTicketsData);
                
            
            
                
                await Leads.bulkCreate(LeadsData);
                
            
            
                
                await Notifications.bulkCreate(NotificationsData);
                
            
            
                
                await AuditLogs.bulkCreate(AuditLogsData);
                
            
            
                
                await WebhookEndpoints.bulkCreate(WebhookEndpointsData);
                
            
            
                
                await WebhookDeliveries.bulkCreate(WebhookDeliveriesData);
                
            
            
                
                await CsvJobs.bulkCreate(CsvJobsData);
                
            
            
                
                await UsageEvents.bulkCreate(UsageEventsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateUserWithOrganization(),
                    
                
            
                
                
                
                
                    
                
            
                
                
                    
                        
                        await associateOrganizationInvitationWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateCustomerWithOrganization(),
                    
                
                    
                        
                        await associateCustomerWithUser(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateSavedAddressWithCustomer(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSavedAddressWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateServicePackageWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateServiceAddOnWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateServiceRequestWithOrganization(),
                    
                
                    
                        
                        await associateServiceRequestWithCustomer(),
                    
                
                    
                        
                        await associateServiceRequestWithRequester_user(),
                    
                
                    
                        
                        await associateServiceRequestWithAssigned_coordinator_user(),
                    
                
                    
                        
                        await associateServiceRequestWithService_package(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateServiceRequestAddOnWithService_request(),
                    
                
                    
                        
                        await associateServiceRequestAddOnWithService_add_on(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateServiceRequestAddOnWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateRequestChecklistItemWithService_request(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateRequestChecklistItemWithAssigned_user(),
                    
                
                    
                
                    
                
                    
                        
                        await associateRequestChecklistItemWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateRequestTimelineEventWithService_request(),
                    
                
                    
                        
                        await associateRequestTimelineEventWithActor_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateRequestTimelineEventWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateRequestDocumentWithService_request(),
                    
                
                    
                        
                        await associateRequestDocumentWithUploaded_by_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateRequestDocumentWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateChatThreadWithOrganization(),
                    
                
                    
                        
                        await associateChatThreadWithService_request(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateChatMessageWithChat_thread(),
                    
                
                    
                        
                        await associateChatMessageWithSender_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateChatMessageWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePaymentTransactionWithOrganization(),
                    
                
                    
                        
                        await associatePaymentTransactionWithCustomer(),
                    
                
                    
                        
                        await associatePaymentTransactionWithService_request(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateInvoiceWithOrganization(),
                    
                
                    
                        
                        await associateInvoiceWithCustomer(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateSubscriptionWithOrganization(),
                    
                
                    
                        
                        await associateSubscriptionWithCustomer(),
                    
                
                    
                        
                        await associateSubscriptionWithService_package(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateLegalDocumentWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateDocumentAcceptanceWithLegal_document(),
                    
                
                    
                        
                        await associateDocumentAcceptanceWithUser(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDocumentAcceptanceWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateSupportTicketWithOrganization(),
                    
                
                    
                        
                        await associateSupportTicketWithCustomer(),
                    
                
                    
                        
                        await associateSupportTicketWithAssigned_admin_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateLeadWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateLeadWithOwner_user(),
                    
                
                    
                
            
                
                
                    
                        
                        await associateNotificationWithOrganization(),
                    
                
                    
                        
                        await associateNotificationWithRecipient_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateAuditLogWithOrganization(),
                    
                
                    
                        
                        await associateAuditLogWithActor_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateWebhookEndpointWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateWebhookDeliveryWithWebhook_endpoint(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateWebhookDeliveryWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCsvJobWithOrganization(),
                    
                
                    
                        
                        await associateCsvJobWithRequested_by_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateUsageEventWithOrganization(),
                    
                
                    
                        
                        await associateUsageEventWithUser(),
                    
                
                    
                
                    
                
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('organizations', null, {});
            
            
            await queryInterface.bulkDelete('organization_invitations', null, {});
            
            
            await queryInterface.bulkDelete('customers', null, {});
            
            
            await queryInterface.bulkDelete('saved_addresses', null, {});
            
            
            await queryInterface.bulkDelete('service_packages', null, {});
            
            
            await queryInterface.bulkDelete('service_add_ons', null, {});
            
            
            await queryInterface.bulkDelete('service_requests', null, {});
            
            
            await queryInterface.bulkDelete('service_request_add_ons', null, {});
            
            
            await queryInterface.bulkDelete('request_checklist_items', null, {});
            
            
            await queryInterface.bulkDelete('request_timeline_events', null, {});
            
            
            await queryInterface.bulkDelete('request_documents', null, {});
            
            
            await queryInterface.bulkDelete('chat_threads', null, {});
            
            
            await queryInterface.bulkDelete('chat_messages', null, {});
            
            
            await queryInterface.bulkDelete('payment_transactions', null, {});
            
            
            await queryInterface.bulkDelete('invoices', null, {});
            
            
            await queryInterface.bulkDelete('subscriptions', null, {});
            
            
            await queryInterface.bulkDelete('legal_documents', null, {});
            
            
            await queryInterface.bulkDelete('document_acceptances', null, {});
            
            
            await queryInterface.bulkDelete('support_tickets', null, {});
            
            
            await queryInterface.bulkDelete('leads', null, {});
            
            
            await queryInterface.bulkDelete('notifications', null, {});
            
            
            await queryInterface.bulkDelete('audit_logs', null, {});
            
            
            await queryInterface.bulkDelete('webhook_endpoints', null, {});
            
            
            await queryInterface.bulkDelete('webhook_deliveries', null, {});
            
            
            await queryInterface.bulkDelete('csv_jobs', null, {});
            
            
            await queryInterface.bulkDelete('usage_events', null, {});
            
        
    },
};