





















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






const Organizations = db.organizations;

const Companies = db.companies;

const CompanyMemberships = db.company_memberships;

const Branches = db.branches;

const Departments = db.departments;

const ComplianceCategories = db.compliance_categories;

const ComplianceTemplates = db.compliance_templates;

const CompanyCompliances = db.company_compliances;

const Tasks = db.tasks;

const Documents = db.documents;

const DocumentVersions = db.document_versions;

const Alerts = db.alerts;

const CalendarEvents = db.calendar_events;

const SubscriptionPlans = db.subscription_plans;

const CompanySubscriptions = db.company_subscriptions;

const Payments = db.payments;

const AiChatSessions = db.ai_chat_sessions;

const AiChatMessages = db.ai_chat_messages;

const AuditLogs = db.audit_logs;

const ActivityEvents = db.activity_events;

const ReportExports = db.report_exports;

const ComplianceRuleOverrides = db.compliance_rule_overrides;

const Integrations = db.integrations;

const NotificationsPreferences = db.notifications_preferences;







const OrganizationsData = [
    
    {
    
        
        
            
                "name": "Ada Lovelace",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Alan Turing",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Grace Hopper",
            
        
    
    },
    
];



const CompaniesData = [
    
    {
    
        
        
            
                "company_name": "Shree Kirana Traders",
            
        
    
        
        
            
                "business_type": "private_limited",
            
        
    
        
        
            
                "industry": "Retail Grocery",
            
        
    
        
        
            
                "gst_number": "27AABCS1234F1Z5",
            
        
    
        
        
            
                "pan_number": "AABCS1234F",
            
        
    
        
        
            
                "cin_number": "NA",
            
        
    
        
        
            
                "state": "assam",
            
        
    
        
        
            
                "employee_count": 8,
            
        
    
        
        
            
                "compliance_score": 78.5,
            
        
    
        
        
            
                "risk_score": 21.2,
            
        
    
        
        
            
                "is_demo": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "company_name": "SpiceRoute Restaurant Pvt Ltd",
            
        
    
        
        
            
                "business_type": "society",
            
        
    
        
        
            
                "industry": "Restaurant",
            
        
    
        
        
            
                "gst_number": "36AASCS6789L1Z2",
            
        
    
        
        
            
                "pan_number": "AASCS6789L",
            
        
    
        
        
            
                "cin_number": "U55209TG2020PTC123456",
            
        
    
        
        
            
                "state": "tripura",
            
        
    
        
        
            
                "employee_count": 32,
            
        
    
        
        
            
                "compliance_score": 71.0,
            
        
    
        
        
            
                "risk_score": 34.8,
            
        
    
        
        
            
                "is_demo": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "company_name": "Vardhan Manufacturing Works",
            
        
    
        
        
            
                "business_type": "huf",
            
        
    
        
        
            
                "industry": "Light Engineering",
            
        
    
        
        
            
                "gst_number": "29AAFCV2345K1Z9",
            
        
    
        
        
            
                "pan_number": "AAFCV2345K",
            
        
    
        
        
            
                "cin_number": "NA",
            
        
    
        
        
            
                "state": "puducherry",
            
        
    
        
        
            
                "employee_count": 64,
            
        
    
        
        
            
                "compliance_score": 66.3,
            
        
    
        
        
            
                "risk_score": 41.5,
            
        
    
        
        
            
                "is_demo": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CompanyMembershipsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "role_in_company": "compliance_manager",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "joined_at": new Date('2026-01-05T09:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "role_in_company": "accountant",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "joined_at": new Date('2026-02-10T09:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "role_in_company": "compliance_manager",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "joined_at": new Date('2026-02-15T09:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const BranchesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "branch_name": "Shree Kirana Main Store",
            
        
    
        
        
            
                "address_line1": "12 Market Road",
            
        
    
        
        
            
                "address_line2": "Near City Bus Stand",
            
        
    
        
        
            
                "city": "Pune",
            
        
    
        
        
            
                "state": "chhattisgarh",
            
        
    
        
        
            
                "pincode": "411001",
            
        
    
        
        
            
                "gst_registration_number": "27AABCS1234F1Z5",
            
        
    
        
        
            
                "is_head_office": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "branch_name": "SpiceRoute Banjara Hills",
            
        
    
        
        
            
                "address_line1": "Road No 12",
            
        
    
        
        
            
                "address_line2": "Banjara Hills",
            
        
    
        
        
            
                "city": "Hyderabad",
            
        
    
        
        
            
                "state": "assam",
            
        
    
        
        
            
                "pincode": "500034",
            
        
    
        
        
            
                "gst_registration_number": "36AASCS6789L1Z2",
            
        
    
        
        
            
                "is_head_office": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "branch_name": "Vardhan Peenya Unit",
            
        
    
        
        
            
                "address_line1": "Plot 44 Industrial Area",
            
        
    
        
        
            
                "address_line2": "Peenya Phase 2",
            
        
    
        
        
            
                "city": "Bengaluru",
            
        
    
        
        
            
                "state": "haryana",
            
        
    
        
        
            
                "pincode": "560058",
            
        
    
        
        
            
                "gst_registration_number": "29AAFCV2345K1Z9",
            
        
    
        
        
            
                "is_head_office": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const DepartmentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "department_name": "Finance and Accounts",
            
        
    
        
        
            
                "description": "Handles bookkeeping, payments, and tax coordination.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "department_name": "HR and Payroll",
            
        
    
        
        
            
                "description": "Manages payroll, PF, ESI and statutory registers.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "department_name": "Factory Operations",
            
        
    
        
        
            
                "description": "Production, safety, and shop floor compliance.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ComplianceCategoriesData = [
    
    {
    
        
        
            
                "category_name": "GST Compliance",
            
        
    
        
        
            
                "category_type": "licenses",
            
        
    
        
        
            
                "description": "GST returns and payments tracking.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "category_name": "TDS Compliance",
            
        
    
        
        
            
                "category_type": "secretarial",
            
        
    
        
        
            
                "description": "TDS deductions, deposits, and statements.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "category_name": "Labor Compliance",
            
        
    
        
        
            
                "category_type": "gst",
            
        
    
        
        
            
                "description": "PF, ESI, bonus and employment related compliance.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ComplianceTemplatesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "template_name": "GSTR-1 Monthly Return",
            
        
    
        
        
            
                "code": "GST_GSTR1_M",
            
        
    
        
        
            
                "frequency": "event_based",
            
        
    
        
        
            
                "due_day_of_month": 11,
            
        
    
        
        
            
                "due_month_of_year": 0,
            
        
    
        
        
            
                "grace_days": 2,
            
        
    
        
        
            
                "applies_to_business_type": "public_limited",
            
        
    
        
        
            
                "applies_to_industry": "Any",
            
        
    
        
        
            
                "applies_to_state": "uttarakhand",
            
        
    
        
        
            
                "min_employee_count": 0,
            
        
    
        
        
            
                "max_employee_count": 1000000,
            
        
    
        
        
            
                "risk_level": "critical",
            
        
    
        
        
            
                "legal_reference": "CGST Act and Rules",
            
        
    
        
        
            
                "instructions": "Prepare outward supplies details and file GSTR-1 before due date.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "template_name": "GSTR-3B Monthly Return",
            
        
    
        
        
            
                "code": "GST_GSTR3B_M",
            
        
    
        
        
            
                "frequency": "half_yearly",
            
        
    
        
        
            
                "due_day_of_month": 20,
            
        
    
        
        
            
                "due_month_of_year": 0,
            
        
    
        
        
            
                "grace_days": 2,
            
        
    
        
        
            
                "applies_to_business_type": "llp",
            
        
    
        
        
            
                "applies_to_industry": "Any",
            
        
    
        
        
            
                "applies_to_state": "telangana",
            
        
    
        
        
            
                "min_employee_count": 0,
            
        
    
        
        
            
                "max_employee_count": 1000000,
            
        
    
        
        
            
                "risk_level": "low",
            
        
    
        
        
            
                "legal_reference": "CGST Act and Rules",
            
        
    
        
        
            
                "instructions": "File summary return GSTR-3B and pay tax liability.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "template_name": "TDS Payment Monthly",
            
        
    
        
        
            
                "code": "TDS_PAY_M",
            
        
    
        
        
            
                "frequency": "half_yearly",
            
        
    
        
        
            
                "due_day_of_month": 7,
            
        
    
        
        
            
                "due_month_of_year": 0,
            
        
    
        
        
            
                "grace_days": 0,
            
        
    
        
        
            
                "applies_to_business_type": "proprietorship",
            
        
    
        
        
            
                "applies_to_industry": "Any",
            
        
    
        
        
            
                "applies_to_state": "telangana",
            
        
    
        
        
            
                "min_employee_count": 1,
            
        
    
        
        
            
                "max_employee_count": 1000000,
            
        
    
        
        
            
                "risk_level": "low",
            
        
    
        
        
            
                "legal_reference": "Income Tax Act",
            
        
    
        
        
            
                "instructions": "Deposit TDS deducted in the previous month by the 7th.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CompanyCompliancesData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "compliance_title": "SpiceRoute GSTR-1 May 2026",
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                "priority": "low",
            
        
    
        
        
            
                "risk_level": "critical",
            
        
    
        
        
            
                "period_start_at": new Date('2026-05-01T00:00:00Z'),
            
        
    
        
        
            
                "period_end_at": new Date('2026-05-31T23:59:59Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-11T18:29:59Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-10T12:00:00Z'),
            
        
    
        
        
            
                "penalty_estimate": 0,
            
        
    
        
        
            
                "notes": "Sales invoices reconciled with POS reports.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "compliance_title": "SpiceRoute GSTR-3B May 2026",
            
        
    
        
        
            
                "status": "submitted",
            
        
    
        
        
            
                "priority": "urgent",
            
        
    
        
        
            
                "risk_level": "medium",
            
        
    
        
        
            
                "period_start_at": new Date('2026-05-01T00:00:00Z'),
            
        
    
        
        
            
                "period_end_at": new Date('2026-05-31T23:59:59Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-20T18:29:59Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-19T12:00:00Z'),
            
        
    
        
        
            
                "penalty_estimate": 8500,
            
        
    
        
        
            
                "notes": "Input tax credit to be verified with vendor invoices.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "compliance_title": "Vardhan TDS Payment May 2026",
            
        
    
        
        
            
                "status": "waived",
            
        
    
        
        
            
                "priority": "low",
            
        
    
        
        
            
                "risk_level": "critical",
            
        
    
        
        
            
                "period_start_at": new Date('2026-05-01T00:00:00Z'),
            
        
    
        
        
            
                "period_end_at": new Date('2026-05-31T23:59:59Z'),
            
        
    
        
        
            
                "due_at": new Date('2026-06-07T18:29:59Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-06T10:30:00Z'),
            
        
    
        
        
            
                "penalty_estimate": 0,
            
        
    
        
        
            
                "notes": "TDS deducted on contractor payments.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const TasksData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "task_title": "Reconcile outward supplies for May",
            
        
    
        
        
            
                "description": "Match POS daily totals with GST sales register and fix invoice numbering gaps.",
            
        
    
        
        
            
                "status": "done",
            
        
    
        
        
            
                "priority": "low",
            
        
    
        
        
            
                "due_at": new Date('2026-06-07T18:00:00Z'),
            
        
    
        
        
            
                "started_at": new Date('2026-06-02T09:30:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-07T15:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "estimated_hours": 6,
            
        
    
        
        
            
                "actual_hours": 5.5,
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "task_title": "Validate ITC with top vendors",
            
        
    
        
        
            
                "description": "Collect missing vendor invoices and verify GSTR-2B matching for May.",
            
        
    
        
        
            
                "status": "done",
            
        
    
        
        
            
                "priority": "medium",
            
        
    
        
        
            
                "due_at": new Date('2026-06-15T18:00:00Z'),
            
        
    
        
        
            
                "started_at": new Date('2026-06-05T09:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-14T16:30:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "estimated_hours": 8,
            
        
    
        
        
            
                "actual_hours": 7.25,
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "task_title": "Prepare TDS challan and pay",
            
        
    
        
        
            
                "description": "Compute TDS for May contractor payments and pay via net banking.",
            
        
    
        
        
            
                "status": "done",
            
        
    
        
        
            
                "priority": "high",
            
        
    
        
        
            
                "due_at": new Date('2026-06-06T18:00:00Z'),
            
        
    
        
        
            
                "started_at": new Date('2026-06-05T10:00:00Z'),
            
        
    
        
        
            
                "completed_at": new Date('2026-06-06T10:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "estimated_hours": 3,
            
        
    
        
        
            
                "actual_hours": 2.5,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const DocumentsData = [
    
    {
    
        
        
            
                // 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
            
        
    
        
        
            
                "document_title": "SpiceRoute GSTR-1 Working File May 2026",
            
        
    
        
        
            
                "document_type": "invoice",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "file_name": "gstr1_may_2026_spiceroute.pdf",
            
        
    
        
        
            
                "mime_type": "application/pdf",
            
        
    
        
        
            
                "file_size_bytes": 482130,
            
        
    
        
        
            
                "version_label": "v1",
            
        
    
        
        
            
                "is_latest": true,
            
        
    
        
        
            
                "issued_at": new Date('2026-06-05T10:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2027-06-05T10:00:00Z'),
            
        
    
        
        
            
                "tags": "gst,gstr1,may2026",
            
        
    
        
        
            
                "notes": "Prepared for review before filing.",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "document_title": "Vardhan TDS Challan May 2026",
            
        
    
        
        
            
                "document_type": "challan",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "file_name": "tds_challan_may_2026.pdf",
            
        
    
        
        
            
                "mime_type": "application/pdf",
            
        
    
        
        
            
                "file_size_bytes": 210445,
            
        
    
        
        
            
                "version_label": "v1",
            
        
    
        
        
            
                "is_latest": true,
            
        
    
        
        
            
                "issued_at": new Date('2026-06-06T12:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2031-06-06T12:00:00Z'),
            
        
    
        
        
            
                "tags": "tds,challan,may2026",
            
        
    
        
        
            
                "notes": "Payment confirmed; keep for audit.",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "document_title": "SpiceRoute FSSAI License Certificate",
            
        
    
        
        
            
                "document_type": "certificate",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "file_name": "fssai_certificate_spiceroute.pdf",
            
        
    
        
        
            
                "mime_type": "application/pdf",
            
        
    
        
        
            
                "file_size_bytes": 355902,
            
        
    
        
        
            
                "version_label": "v2",
            
        
    
        
        
            
                "is_latest": true,
            
        
    
        
        
            
                "issued_at": new Date('2025-08-15T10:00:00Z'),
            
        
    
        
        
            
                "expires_at": new Date('2026-08-15T10:00:00Z'),
            
        
    
        
        
            
                "tags": "license,fssai,restaurant",
            
        
    
        
        
            
                "notes": "Current license expiring in August; renewal in progress.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const DocumentVersionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "file_name": "gstr1_may_2026_spiceroute_v1.pdf",
            
        
    
        
        
            
                "mime_type": "application/pdf",
            
        
    
        
        
            
                "file_size_bytes": 482130,
            
        
    
        
        
            
                "change_notes": "Initial compilation from POS exports.",
            
        
    
        
        
            
                "uploaded_at": new Date('2026-06-05T10:00:00Z'),
            
        
    
        
        
            
                // 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 "files" field
            
        
    
        
        
            
                "file_name": "gstr1_may_2026_spiceroute_v2.pdf",
            
        
    
        
        
            
                "mime_type": "application/pdf",
            
        
    
        
        
            
                "file_size_bytes": 501880,
            
        
    
        
        
            
                "change_notes": "Corrected invoice series and added credit notes.",
            
        
    
        
        
            
                "uploaded_at": new Date('2026-06-07T09:30:00Z'),
            
        
    
        
        
            
                // 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 "files" field
            
        
    
        
        
            
                "file_name": "fssai_certificate_spiceroute_v1.pdf",
            
        
    
        
        
            
                "mime_type": "application/pdf",
            
        
    
        
        
            
                "file_size_bytes": 340012,
            
        
    
        
        
            
                "change_notes": "Previous year certificate.",
            
        
    
        
        
            
                "uploaded_at": new Date('2025-08-16T10:15:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const AlertsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "severity": "info",
            
        
    
        
        
            
                "title": "PF ECR is overdue",
            
        
    
        
        
            
                "message": "PF ECR for May is overdue. Please finalize wage sheet and file immediately to reduce damages.",
            
        
    
        
        
            
                "trigger_at": new Date('2026-06-16T06:00:00Z'),
            
        
    
        
        
            
                "sent_at": new Date('2026-06-16T06:02:00Z'),
            
        
    
        
        
            
                "channel": "dashboard",
            
        
    
        
        
            
                "status": "sent",
            
        
    
        
        
            
                "escalation_level": 1,
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "severity": "critical",
            
        
    
        
        
            
                "title": "GSTR-3B due soon",
            
        
    
        
        
            
                "message": "GSTR-3B for May is due on 20 Jun. Verify ITC and prepare payment challan.",
            
        
    
        
        
            
                "trigger_at": new Date('2026-06-12T06:00:00Z'),
            
        
    
        
        
            
                "sent_at": new Date('2026-06-12T06:01:00Z'),
            
        
    
        
        
            
                "channel": "whatsapp",
            
        
    
        
        
            
                "status": "scheduled",
            
        
    
        
        
            
                "escalation_level": 0,
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "severity": "critical",
            
        
    
        
        
            
                "title": "FSSAI renewal document collection",
            
        
    
        
        
            
                "message": "Collect renewal documents and track inspection date for timely submission.",
            
        
    
        
        
            
                "trigger_at": new Date('2026-06-03T06:00:00Z'),
            
        
    
        
        
            
                "sent_at": new Date('2026-06-03T06:01:00Z'),
            
        
    
        
        
            
                "channel": "whatsapp",
            
        
    
        
        
            
                "status": "failed",
            
        
    
        
        
            
                "escalation_level": 0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CalendarEventsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_title": "GSTR-1 Due: May 2026",
            
        
    
        
        
            
                "description": "Deadline for filing GSTR-1 for May period.",
            
        
    
        
        
            
                "start_at": new Date('2026-06-11T09:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-06-11T09:30:00Z'),
            
        
    
        
        
            
                "color": "red",
            
        
    
        
        
            
                "all_day": false,
            
        
    
        
        
            
                "google_calendar_event_key": "gcal_spiceroute_gstr1_may_2026",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "event_title": "GSTR-3B Due: May 2026",
            
        
    
        
        
            
                "description": "Deadline for filing GSTR-3B and tax payment for May.",
            
        
    
        
        
            
                "start_at": new Date('2026-06-20T09:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-06-20T09:30:00Z'),
            
        
    
        
        
            
                "color": "orange",
            
        
    
        
        
            
                "all_day": true,
            
        
    
        
        
            
                "google_calendar_event_key": "gcal_spiceroute_gstr3b_may_2026",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "event_title": "PF ECR Due: May 2026",
            
        
    
        
        
            
                "description": "PF ECR filing deadline for May wages.",
            
        
    
        
        
            
                "start_at": new Date('2026-06-15T09:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-06-15T09:30:00Z'),
            
        
    
        
        
            
                "color": "orange",
            
        
    
        
        
            
                "all_day": false,
            
        
    
        
        
            
                "google_calendar_event_key": "gcal_vardhan_pf_may_2026",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SubscriptionPlansData = [
    
    {
    
        
        
            
                "plan_name": "Starter",
            
        
    
        
        
            
                "plan_tier": "professional",
            
        
    
        
        
            
                "price_monthly": 1999,
            
        
    
        
        
            
                "price_yearly": 19990,
            
        
    
        
        
            
                "max_users": 5,
            
        
    
        
        
            
                "max_branches": 1,
            
        
    
        
        
            
                "max_documents": 500,
            
        
    
        
        
            
                "ai_assistant_enabled": true,
            
        
    
        
        
            
                "whatsapp_alerts_enabled": false,
            
        
    
        
        
            
                "custom_rules_enabled": false,
            
        
    
        
        
            
                "features_note": "Core compliance tracking with email and dashboard alerts.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "plan_name": "Professional",
            
        
    
        
        
            
                "plan_tier": "enterprise",
            
        
    
        
        
            
                "price_monthly": 4999,
            
        
    
        
        
            
                "price_yearly": 49990,
            
        
    
        
        
            
                "max_users": 20,
            
        
    
        
        
            
                "max_branches": 5,
            
        
    
        
        
            
                "max_documents": 5000,
            
        
    
        
        
            
                "ai_assistant_enabled": true,
            
        
    
        
        
            
                "whatsapp_alerts_enabled": true,
            
        
    
        
        
            
                "custom_rules_enabled": true,
            
        
    
        
        
            
                "features_note": "Advanced alerts, WhatsApp reminders and rule overrides.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "plan_name": "Enterprise",
            
        
    
        
        
            
                "plan_tier": "starter",
            
        
    
        
        
            
                "price_monthly": 12999,
            
        
    
        
        
            
                "price_yearly": 129990,
            
        
    
        
        
            
                "max_users": 200,
            
        
    
        
        
            
                "max_branches": 50,
            
        
    
        
        
            
                "max_documents": 50000,
            
        
    
        
        
            
                "ai_assistant_enabled": true,
            
        
    
        
        
            
                "whatsapp_alerts_enabled": true,
            
        
    
        
        
            
                "custom_rules_enabled": true,
            
        
    
        
        
            
                "features_note": "Large scale support, integrations and priority service.",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const CompanySubscriptionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "billing_provider": "razorpay",
            
        
    
        
        
            
                "status": "cancelled",
            
        
    
        
        
            
                "current_period_start_at": new Date('2026-05-01T00:00:00Z'),
            
        
    
        
        
            
                "current_period_end_at": new Date('2026-05-31T23:59:59Z'),
            
        
    
        
        
            
                "trial_end_at": new Date('2026-04-30T23:59:59Z'),
            
        
    
        
        
            
                "provider_customer_key": "rzp_cust_9a1b2c3d4e",
            
        
    
        
        
            
                "provider_subscription_key": "rzp_sub_aa11bb22cc",
            
        
    
        
        
            
                "auto_renew": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "billing_provider": "razorpay",
            
        
    
        
        
            
                "status": "past_due",
            
        
    
        
        
            
                "current_period_start_at": new Date('2026-05-15T00:00:00Z'),
            
        
    
        
        
            
                "current_period_end_at": new Date('2026-06-14T23:59:59Z'),
            
        
    
        
        
            
                "trial_end_at": new Date('2026-05-14T23:59:59Z'),
            
        
    
        
        
            
                "provider_customer_key": "cus_SpiceRoute001",
            
        
    
        
        
            
                "provider_subscription_key": "sub_SpiceRoutePro001",
            
        
    
        
        
            
                "auto_renew": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "billing_provider": "stripe",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "current_period_start_at": new Date('2026-04-20T00:00:00Z'),
            
        
    
        
        
            
                "current_period_end_at": new Date('2026-05-19T23:59:59Z'),
            
        
    
        
        
            
                "trial_end_at": new Date('2026-04-19T23:59:59Z'),
            
        
    
        
        
            
                "provider_customer_key": "rzp_cust_7f6e5d4c3b",
            
        
    
        
        
            
                "provider_subscription_key": "rzp_sub_dd33ee44ff",
            
        
    
        
        
            
                "auto_renew": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const PaymentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider": "stripe",
            
        
    
        
        
            
                "provider_payment_key": "pay_rzp_001",
            
        
    
        
        
            
                "amount": 1999,
            
        
    
        
        
            
                "currency": "INR",
            
        
    
        
        
            
                "status": "captured",
            
        
    
        
        
            
                "paid_at": new Date('2026-05-01T10:05:00Z'),
            
        
    
        
        
            
                "invoice_number": "NYAI-INV-2026-0001",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider": "razorpay",
            
        
    
        
        
            
                "provider_payment_key": "pi_stripe_002",
            
        
    
        
        
            
                "amount": 4999,
            
        
    
        
        
            
                "currency": "INR",
            
        
    
        
        
            
                "status": "captured",
            
        
    
        
        
            
                "paid_at": new Date('2026-05-15T09:20:00Z'),
            
        
    
        
        
            
                "invoice_number": "NYAI-INV-2026-0002",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "provider": "razorpay",
            
        
    
        
        
            
                "provider_payment_key": "pay_rzp_003",
            
        
    
        
        
            
                "amount": 4999,
            
        
    
        
        
            
                "currency": "INR",
            
        
    
        
        
            
                "status": "captured",
            
        
    
        
        
            
                "paid_at": new Date('2026-05-20T09:00:00Z'),
            
        
    
        
        
            
                "invoice_number": "NYAI-INV-2026-0003",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const AiChatSessionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "session_title": "June Compliance Check",
            
        
    
        
        
            
                "channel": "mobile",
            
        
    
        
        
            
                "started_at": new Date('2026-06-01T08:00:00Z'),
            
        
    
        
        
            
                "last_message_at": new Date('2026-06-01T08:15:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "session_title": "GST Filing Help",
            
        
    
        
        
            
                "channel": "mobile",
            
        
    
        
        
            
                "started_at": new Date('2026-06-02T10:00:00Z'),
            
        
    
        
        
            
                "last_message_at": new Date('2026-06-02T10:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "session_title": "TDS Payment Guidance",
            
        
    
        
        
            
                "channel": "api",
            
        
    
        
        
            
                "started_at": new Date('2026-06-03T09:00:00Z'),
            
        
    
        
        
            
                "last_message_at": new Date('2026-06-03T09:12:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const AiChatMessagesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sender_type": "assistant",
            
        
    
        
        
            
                "message_text": "What filings are due this month for SpiceRoute?",
            
        
    
        
        
            
                "sent_at": new Date('2026-06-01T08:01:00Z'),
            
        
    
        
        
            
                "answer_type": "general",
            
        
    
        
        
            
                "confidence_score": 0.86,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sender_type": "user",
            
        
    
        
        
            
                "message_text": "For June: GSTR-1 due 11 Jun, PF ECR due 15 Jun if applicable, GSTR-3B due 20 Jun, and TDS payment due 7 Jun if you deducted TDS in May.",
            
        
    
        
        
            
                "sent_at": new Date('2026-06-01T08:02:00Z'),
            
        
    
        
        
            
                "answer_type": "explanation",
            
        
    
        
        
            
                "confidence_score": 0.78,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "sender_type": "user",
            
        
    
        
        
            
                "message_text": "What penalties apply if GSTR-3B is late?",
            
        
    
        
        
            
                "sent_at": new Date('2026-06-02T10:01:00Z'),
            
        
    
        
        
            
                "answer_type": "deadlines",
            
        
    
        
        
            
                "confidence_score": 0.82,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const AuditLogsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action": "document_uploaded",
            
        
    
        
        
            
                "entity_name": "documents",
            
        
    
        
        
            
                "entity_key": "1",
            
        
    
        
        
            
                "summary": "Uploaded GSTR-1 working file for May 2026.",
            
        
    
        
        
            
                "occurred_at": new Date('2026-06-05T10:00:10Z'),
            
        
    
        
        
            
                "ip_address": "203.0.113.10",
            
        
    
        
        
            
                "user_agent": "Chrome 126",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action": "payment_recorded",
            
        
    
        
        
            
                "entity_name": "payments",
            
        
    
        
        
            
                "entity_key": "3",
            
        
    
        
        
            
                "summary": "Payment attempt recorded for Professional plan renewal.",
            
        
    
        
        
            
                "occurred_at": new Date('2026-05-20T09:00:05Z'),
            
        
    
        
        
            
                "ip_address": "203.0.113.11",
            
        
    
        
        
            
                "user_agent": "Chrome 126",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action": "task_created",
            
        
    
        
        
            
                "entity_name": "tasks",
            
        
    
        
        
            
                "entity_key": "2",
            
        
    
        
        
            
                "summary": "Created task to validate ITC with top vendors.",
            
        
    
        
        
            
                "occurred_at": new Date('2026-06-05T09:05:00Z'),
            
        
    
        
        
            
                "ip_address": "203.0.113.12",
            
        
    
        
        
            
                "user_agent": "Safari 17",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ActivityEventsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "task_created",
            
        
    
        
        
            
                "event_title": "User login",
            
        
    
        
        
            
                "details": "Logged in using Google provider.",
            
        
    
        
        
            
                "event_at": new Date('2026-05-30T07:40:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "alert_sent",
            
        
    
        
        
            
                "event_title": "Task created",
            
        
    
        
        
            
                "details": "Created ITC validation task for GSTR-3B preparation.",
            
        
    
        
        
            
                "event_at": new Date('2026-06-05T09:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "event_type": "task_completed",
            
        
    
        
        
            
                "event_title": "Compliance completed",
            
        
    
        
        
            
                "details": "TDS payment compliance marked completed for May 2026.",
            
        
    
        
        
            
                "event_at": new Date('2026-06-06T10:30:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ReportExportsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "report_type": "missed_deadlines",
            
        
    
        
        
            
                "format": "excel",
            
        
    
        
        
            
                "requested_at": new Date('2026-06-01T12:00:00Z'),
            
        
    
        
        
            
                "generated_at": new Date('2026-06-01T12:01:20Z'),
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "report_type": "missed_deadlines",
            
        
    
        
        
            
                "format": "pdf",
            
        
    
        
        
            
                "requested_at": new Date('2026-06-02T11:00:00Z'),
            
        
    
        
        
            
                "generated_at": new Date('2026-06-02T11:02:10Z'),
            
        
    
        
        
            
                "status": "completed",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "report_type": "risk_analysis",
            
        
    
        
        
            
                "format": "excel",
            
        
    
        
        
            
                "requested_at": new Date('2026-06-18T08:30:00Z'),
            
        
    
        
        
            
                "generated_at": new Date('2026-06-18T08:32:00Z'),
            
        
    
        
        
            
                "status": "queued",
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ComplianceRuleOverridesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "override_title": "GSTR-3B internal target earlier",
            
        
    
        
        
            
                "frequency": "one_time",
            
        
    
        
        
            
                "due_day_of_month": 18,
            
        
    
        
        
            
                "due_month_of_year": 0,
            
        
    
        
        
            
                "grace_days": 2,
            
        
    
        
        
            
                "risk_level": "inherit",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "reason": "Keep buffer for payment approval and bank processing.",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "override_title": "PF ECR due date strict monitoring",
            
        
    
        
        
            
                "frequency": "quarterly",
            
        
    
        
        
            
                "due_day_of_month": 15,
            
        
    
        
        
            
                "due_month_of_year": 0,
            
        
    
        
        
            
                "grace_days": 0,
            
        
    
        
        
            
                "risk_level": "low",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "reason": "High workforce size; delays increase damages risk.",
            
        
    
        
        
            
                // 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
            
        
    
        
        
            
                "override_title": "GSTR-1 reminder for small retail",
            
        
    
        
        
            
                "frequency": "quarterly",
            
        
    
        
        
            
                "due_day_of_month": 10,
            
        
    
        
        
            
                "due_month_of_year": 0,
            
        
    
        
        
            
                "grace_days": 2,
            
        
    
        
        
            
                "risk_level": "low",
            
        
    
        
        
            
                "is_active": true,
            
        
    
        
        
            
                "reason": "Owner prefers one day early internal cutoff.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const IntegrationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "integration_type": "email_smtp",
            
        
    
        
        
            
                "display_name": "SpiceRoute Google Calendar",
            
        
    
        
        
            
                "status": "disabled",
            
        
    
        
        
            
                "config_json": "{calendarId:primary,syncWindowDays:90}",
            
        
    
        
        
            
                "connected_at": new Date('2026-05-20T08:00:00Z'),
            
        
    
        
        
            
                "last_sync_at": new Date('2026-06-01T06:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "integration_type": "sms_gateway",
            
        
    
        
        
            
                "display_name": "WhatsApp Alerts Provider",
            
        
    
        
        
            
                "status": "disabled",
            
        
    
        
        
            
                "config_json": "{provider:meta,sender:NYAYAI}",
            
        
    
        
        
            
                "connected_at": new Date('2026-05-22T08:30:00Z'),
            
        
    
        
        
            
                "last_sync_at": new Date('2026-06-01T06:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "integration_type": "stripe",
            
        
    
        
        
            
                "display_name": "Razorpay Billing",
            
        
    
        
        
            
                "status": "enabled",
            
        
    
        
        
            
                "config_json": "{webhookEnabled:true,currency:INR}",
            
        
    
        
        
            
                "connected_at": new Date('2026-04-20T09:00:00Z'),
            
        
    
        
        
            
                "last_sync_at": new Date('2026-05-20T09:01:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const NotificationsPreferencesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "dashboard_enabled": true,
            
        
    
        
        
            
                "email_enabled": true,
            
        
    
        
        
            
                "sms_enabled": false,
            
        
    
        
        
            
                "whatsapp_enabled": true,
            
        
    
        
        
            
                "remind_days_before": 7,
            
        
    
        
        
            
                "escalate_after_days_overdue": 2,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "dashboard_enabled": true,
            
        
    
        
        
            
                "email_enabled": true,
            
        
    
        
        
            
                "sms_enabled": true,
            
        
    
        
        
            
                "whatsapp_enabled": true,
            
        
    
        
        
            
                "remind_days_before": 10,
            
        
    
        
        
            
                "escalate_after_days_overdue": 1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "dashboard_enabled": true,
            
        
    
        
        
            
                "email_enabled": true,
            
        
    
        
        
            
                "sms_enabled": true,
            
        
    
        
        
            
                "whatsapp_enabled": true,
            
        
    
        
        
            
                "remind_days_before": 5,
            
        
    
        
        
            
                "escalate_after_days_overdue": 2,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];




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

    
    
    
    
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCompanyWithOwner_user() {
            
                const relatedOwner_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Company0 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Company0?.setOwner_user)
                {
                    await
                    Company0.
                    setOwner_user(relatedOwner_user0);
                }
            
                const relatedOwner_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Company1 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Company1?.setOwner_user)
                {
                    await
                    Company1.
                    setOwner_user(relatedOwner_user1);
                }
            
                const relatedOwner_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Company2 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Company2?.setOwner_user)
                {
                    await
                    Company2.
                    setOwner_user(relatedOwner_user2);
                }
            
        }
        
    
        
            
            async function associateCompanyWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Company0 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Company0?.setOrganization)
                {
                    await
                    Company0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Company1 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Company1?.setOrganization)
                {
                    await
                    Company1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Company2 = await Companies.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Company2?.setOrganization)
                {
                    await
                    Company2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCompanyMembershipWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const CompanyMembership0 = await CompanyMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CompanyMembership0?.setCompany)
                {
                    await
                    CompanyMembership0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const CompanyMembership1 = await CompanyMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CompanyMembership1?.setCompany)
                {
                    await
                    CompanyMembership1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const CompanyMembership2 = await CompanyMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CompanyMembership2?.setCompany)
                {
                    await
                    CompanyMembership2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateCompanyMembershipWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CompanyMembership0 = await CompanyMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CompanyMembership0?.setUser)
                {
                    await
                    CompanyMembership0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CompanyMembership1 = await CompanyMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CompanyMembership1?.setUser)
                {
                    await
                    CompanyMembership1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CompanyMembership2 = await CompanyMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CompanyMembership2?.setUser)
                {
                    await
                    CompanyMembership2.
                    setUser(relatedUser2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateCompanyMembershipWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CompanyMembership0 = await CompanyMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CompanyMembership0?.setOrganization)
                {
                    await
                    CompanyMembership0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CompanyMembership1 = await CompanyMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CompanyMembership1?.setOrganization)
                {
                    await
                    CompanyMembership1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CompanyMembership2 = await CompanyMemberships.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CompanyMembership2?.setOrganization)
                {
                    await
                    CompanyMembership2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateBrancheWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Branche0 = await Branches.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Branche0?.setCompany)
                {
                    await
                    Branche0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Branche1 = await Branches.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Branche1?.setCompany)
                {
                    await
                    Branche1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Branche2 = await Branches.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Branche2?.setCompany)
                {
                    await
                    Branche2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateBrancheWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Branche0 = await Branches.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Branche0?.setOrganization)
                {
                    await
                    Branche0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Branche1 = await Branches.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Branche1?.setOrganization)
                {
                    await
                    Branche1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Branche2 = await Branches.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Branche2?.setOrganization)
                {
                    await
                    Branche2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateDepartmentWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Department0 = await Departments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Department0?.setCompany)
                {
                    await
                    Department0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Department1 = await Departments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Department1?.setCompany)
                {
                    await
                    Department1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Department2 = await Departments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Department2?.setCompany)
                {
                    await
                    Department2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateDepartmentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Department0 = await Departments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Department0?.setOrganization)
                {
                    await
                    Department0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Department1 = await Departments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Department1?.setOrganization)
                {
                    await
                    Department1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Department2 = await Departments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Department2?.setOrganization)
                {
                    await
                    Department2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
            
            async function associateComplianceCategoryWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ComplianceCategory0 = await ComplianceCategories.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ComplianceCategory0?.setOrganization)
                {
                    await
                    ComplianceCategory0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ComplianceCategory1 = await ComplianceCategories.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ComplianceCategory1?.setOrganization)
                {
                    await
                    ComplianceCategory1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ComplianceCategory2 = await ComplianceCategories.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ComplianceCategory2?.setOrganization)
                {
                    await
                    ComplianceCategory2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateComplianceTemplateWithCategory() {
            
                const relatedCategory0 = await ComplianceCategories.findOne({
                    offset: Math.floor(Math.random() * (await ComplianceCategories.count())),
                });
                const ComplianceTemplate0 = await ComplianceTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ComplianceTemplate0?.setCategory)
                {
                    await
                    ComplianceTemplate0.
                    setCategory(relatedCategory0);
                }
            
                const relatedCategory1 = await ComplianceCategories.findOne({
                    offset: Math.floor(Math.random() * (await ComplianceCategories.count())),
                });
                const ComplianceTemplate1 = await ComplianceTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ComplianceTemplate1?.setCategory)
                {
                    await
                    ComplianceTemplate1.
                    setCategory(relatedCategory1);
                }
            
                const relatedCategory2 = await ComplianceCategories.findOne({
                    offset: Math.floor(Math.random() * (await ComplianceCategories.count())),
                });
                const ComplianceTemplate2 = await ComplianceTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ComplianceTemplate2?.setCategory)
                {
                    await
                    ComplianceTemplate2.
                    setCategory(relatedCategory2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateComplianceTemplateWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ComplianceTemplate0 = await ComplianceTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ComplianceTemplate0?.setOrganization)
                {
                    await
                    ComplianceTemplate0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ComplianceTemplate1 = await ComplianceTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ComplianceTemplate1?.setOrganization)
                {
                    await
                    ComplianceTemplate1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ComplianceTemplate2 = await ComplianceTemplates.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ComplianceTemplate2?.setOrganization)
                {
                    await
                    ComplianceTemplate2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCompanyComplianceWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const CompanyCompliance0 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CompanyCompliance0?.setCompany)
                {
                    await
                    CompanyCompliance0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const CompanyCompliance1 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CompanyCompliance1?.setCompany)
                {
                    await
                    CompanyCompliance1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const CompanyCompliance2 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CompanyCompliance2?.setCompany)
                {
                    await
                    CompanyCompliance2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateCompanyComplianceWithTemplate() {
            
                const relatedTemplate0 = await ComplianceTemplates.findOne({
                    offset: Math.floor(Math.random() * (await ComplianceTemplates.count())),
                });
                const CompanyCompliance0 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CompanyCompliance0?.setTemplate)
                {
                    await
                    CompanyCompliance0.
                    setTemplate(relatedTemplate0);
                }
            
                const relatedTemplate1 = await ComplianceTemplates.findOne({
                    offset: Math.floor(Math.random() * (await ComplianceTemplates.count())),
                });
                const CompanyCompliance1 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CompanyCompliance1?.setTemplate)
                {
                    await
                    CompanyCompliance1.
                    setTemplate(relatedTemplate1);
                }
            
                const relatedTemplate2 = await ComplianceTemplates.findOne({
                    offset: Math.floor(Math.random() * (await ComplianceTemplates.count())),
                });
                const CompanyCompliance2 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CompanyCompliance2?.setTemplate)
                {
                    await
                    CompanyCompliance2.
                    setTemplate(relatedTemplate2);
                }
            
        }
        
    
        
            
            async function associateCompanyComplianceWithBranch() {
            
                const relatedBranch0 = await Branches.findOne({
                    offset: Math.floor(Math.random() * (await Branches.count())),
                });
                const CompanyCompliance0 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CompanyCompliance0?.setBranch)
                {
                    await
                    CompanyCompliance0.
                    setBranch(relatedBranch0);
                }
            
                const relatedBranch1 = await Branches.findOne({
                    offset: Math.floor(Math.random() * (await Branches.count())),
                });
                const CompanyCompliance1 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CompanyCompliance1?.setBranch)
                {
                    await
                    CompanyCompliance1.
                    setBranch(relatedBranch1);
                }
            
                const relatedBranch2 = await Branches.findOne({
                    offset: Math.floor(Math.random() * (await Branches.count())),
                });
                const CompanyCompliance2 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CompanyCompliance2?.setBranch)
                {
                    await
                    CompanyCompliance2.
                    setBranch(relatedBranch2);
                }
            
        }
        
    
        
            
            async function associateCompanyComplianceWithDepartment() {
            
                const relatedDepartment0 = await Departments.findOne({
                    offset: Math.floor(Math.random() * (await Departments.count())),
                });
                const CompanyCompliance0 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CompanyCompliance0?.setDepartment)
                {
                    await
                    CompanyCompliance0.
                    setDepartment(relatedDepartment0);
                }
            
                const relatedDepartment1 = await Departments.findOne({
                    offset: Math.floor(Math.random() * (await Departments.count())),
                });
                const CompanyCompliance1 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CompanyCompliance1?.setDepartment)
                {
                    await
                    CompanyCompliance1.
                    setDepartment(relatedDepartment1);
                }
            
                const relatedDepartment2 = await Departments.findOne({
                    offset: Math.floor(Math.random() * (await Departments.count())),
                });
                const CompanyCompliance2 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CompanyCompliance2?.setDepartment)
                {
                    await
                    CompanyCompliance2.
                    setDepartment(relatedDepartment2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCompanyComplianceWithAssigned_to() {
            
                const relatedAssigned_to0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CompanyCompliance0 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CompanyCompliance0?.setAssigned_to)
                {
                    await
                    CompanyCompliance0.
                    setAssigned_to(relatedAssigned_to0);
                }
            
                const relatedAssigned_to1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CompanyCompliance1 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CompanyCompliance1?.setAssigned_to)
                {
                    await
                    CompanyCompliance1.
                    setAssigned_to(relatedAssigned_to1);
                }
            
                const relatedAssigned_to2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CompanyCompliance2 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CompanyCompliance2?.setAssigned_to)
                {
                    await
                    CompanyCompliance2.
                    setAssigned_to(relatedAssigned_to2);
                }
            
        }
        
    
        
            
            async function associateCompanyComplianceWithCreated_by_user() {
            
                const relatedCreated_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CompanyCompliance0 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CompanyCompliance0?.setCreated_by_user)
                {
                    await
                    CompanyCompliance0.
                    setCreated_by_user(relatedCreated_by_user0);
                }
            
                const relatedCreated_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CompanyCompliance1 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CompanyCompliance1?.setCreated_by_user)
                {
                    await
                    CompanyCompliance1.
                    setCreated_by_user(relatedCreated_by_user1);
                }
            
                const relatedCreated_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const CompanyCompliance2 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CompanyCompliance2?.setCreated_by_user)
                {
                    await
                    CompanyCompliance2.
                    setCreated_by_user(relatedCreated_by_user2);
                }
            
        }
        
    
        
            
            async function associateCompanyComplianceWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CompanyCompliance0 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CompanyCompliance0?.setOrganization)
                {
                    await
                    CompanyCompliance0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CompanyCompliance1 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CompanyCompliance1?.setOrganization)
                {
                    await
                    CompanyCompliance1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CompanyCompliance2 = await CompanyCompliances.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CompanyCompliance2?.setOrganization)
                {
                    await
                    CompanyCompliance2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateTaskWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setCompany)
                {
                    await
                    Task0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setCompany)
                {
                    await
                    Task1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setCompany)
                {
                    await
                    Task2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateTaskWithRelated_compliance() {
            
                const relatedRelated_compliance0 = await CompanyCompliances.findOne({
                    offset: Math.floor(Math.random() * (await CompanyCompliances.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setRelated_compliance)
                {
                    await
                    Task0.
                    setRelated_compliance(relatedRelated_compliance0);
                }
            
                const relatedRelated_compliance1 = await CompanyCompliances.findOne({
                    offset: Math.floor(Math.random() * (await CompanyCompliances.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setRelated_compliance)
                {
                    await
                    Task1.
                    setRelated_compliance(relatedRelated_compliance1);
                }
            
                const relatedRelated_compliance2 = await CompanyCompliances.findOne({
                    offset: Math.floor(Math.random() * (await CompanyCompliances.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setRelated_compliance)
                {
                    await
                    Task2.
                    setRelated_compliance(relatedRelated_compliance2);
                }
            
        }
        
    
        
            
            async function associateTaskWithBranch() {
            
                const relatedBranch0 = await Branches.findOne({
                    offset: Math.floor(Math.random() * (await Branches.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setBranch)
                {
                    await
                    Task0.
                    setBranch(relatedBranch0);
                }
            
                const relatedBranch1 = await Branches.findOne({
                    offset: Math.floor(Math.random() * (await Branches.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setBranch)
                {
                    await
                    Task1.
                    setBranch(relatedBranch1);
                }
            
                const relatedBranch2 = await Branches.findOne({
                    offset: Math.floor(Math.random() * (await Branches.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setBranch)
                {
                    await
                    Task2.
                    setBranch(relatedBranch2);
                }
            
        }
        
    
        
            
            async function associateTaskWithDepartment() {
            
                const relatedDepartment0 = await Departments.findOne({
                    offset: Math.floor(Math.random() * (await Departments.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setDepartment)
                {
                    await
                    Task0.
                    setDepartment(relatedDepartment0);
                }
            
                const relatedDepartment1 = await Departments.findOne({
                    offset: Math.floor(Math.random() * (await Departments.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setDepartment)
                {
                    await
                    Task1.
                    setDepartment(relatedDepartment1);
                }
            
                const relatedDepartment2 = await Departments.findOne({
                    offset: Math.floor(Math.random() * (await Departments.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setDepartment)
                {
                    await
                    Task2.
                    setDepartment(relatedDepartment2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateTaskWithAssignee() {
            
                const relatedAssignee0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setAssignee)
                {
                    await
                    Task0.
                    setAssignee(relatedAssignee0);
                }
            
                const relatedAssignee1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setAssignee)
                {
                    await
                    Task1.
                    setAssignee(relatedAssignee1);
                }
            
                const relatedAssignee2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setAssignee)
                {
                    await
                    Task2.
                    setAssignee(relatedAssignee2);
                }
            
        }
        
    
        
            
            async function associateTaskWithReporter() {
            
                const relatedReporter0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setReporter)
                {
                    await
                    Task0.
                    setReporter(relatedReporter0);
                }
            
                const relatedReporter1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setReporter)
                {
                    await
                    Task1.
                    setReporter(relatedReporter1);
                }
            
                const relatedReporter2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setReporter)
                {
                    await
                    Task2.
                    setReporter(relatedReporter2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateTaskWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Task0 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Task0?.setOrganization)
                {
                    await
                    Task0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Task1 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Task1?.setOrganization)
                {
                    await
                    Task1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Task2 = await Tasks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Task2?.setOrganization)
                {
                    await
                    Task2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateDocumentWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Document0 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Document0?.setCompany)
                {
                    await
                    Document0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Document1 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Document1?.setCompany)
                {
                    await
                    Document1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Document2 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Document2?.setCompany)
                {
                    await
                    Document2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateDocumentWithBranch() {
            
                const relatedBranch0 = await Branches.findOne({
                    offset: Math.floor(Math.random() * (await Branches.count())),
                });
                const Document0 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Document0?.setBranch)
                {
                    await
                    Document0.
                    setBranch(relatedBranch0);
                }
            
                const relatedBranch1 = await Branches.findOne({
                    offset: Math.floor(Math.random() * (await Branches.count())),
                });
                const Document1 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Document1?.setBranch)
                {
                    await
                    Document1.
                    setBranch(relatedBranch1);
                }
            
                const relatedBranch2 = await Branches.findOne({
                    offset: Math.floor(Math.random() * (await Branches.count())),
                });
                const Document2 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Document2?.setBranch)
                {
                    await
                    Document2.
                    setBranch(relatedBranch2);
                }
            
        }
        
    
        
            
            async function associateDocumentWithRelated_compliance() {
            
                const relatedRelated_compliance0 = await CompanyCompliances.findOne({
                    offset: Math.floor(Math.random() * (await CompanyCompliances.count())),
                });
                const Document0 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Document0?.setRelated_compliance)
                {
                    await
                    Document0.
                    setRelated_compliance(relatedRelated_compliance0);
                }
            
                const relatedRelated_compliance1 = await CompanyCompliances.findOne({
                    offset: Math.floor(Math.random() * (await CompanyCompliances.count())),
                });
                const Document1 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Document1?.setRelated_compliance)
                {
                    await
                    Document1.
                    setRelated_compliance(relatedRelated_compliance1);
                }
            
                const relatedRelated_compliance2 = await CompanyCompliances.findOne({
                    offset: Math.floor(Math.random() * (await CompanyCompliances.count())),
                });
                const Document2 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Document2?.setRelated_compliance)
                {
                    await
                    Document2.
                    setRelated_compliance(relatedRelated_compliance2);
                }
            
        }
        
    
        
            
            async function associateDocumentWithUploaded_by() {
            
                const relatedUploaded_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document0 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Document0?.setUploaded_by)
                {
                    await
                    Document0.
                    setUploaded_by(relatedUploaded_by0);
                }
            
                const relatedUploaded_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document1 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Document1?.setUploaded_by)
                {
                    await
                    Document1.
                    setUploaded_by(relatedUploaded_by1);
                }
            
                const relatedUploaded_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Document2 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Document2?.setUploaded_by)
                {
                    await
                    Document2.
                    setUploaded_by(relatedUploaded_by2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateDocumentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Document0 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Document0?.setOrganization)
                {
                    await
                    Document0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Document1 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Document1?.setOrganization)
                {
                    await
                    Document1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Document2 = await Documents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Document2?.setOrganization)
                {
                    await
                    Document2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateDocumentVersionWithDocument() {
            
                const relatedDocument0 = await Documents.findOne({
                    offset: Math.floor(Math.random() * (await Documents.count())),
                });
                const DocumentVersion0 = await DocumentVersions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DocumentVersion0?.setDocument)
                {
                    await
                    DocumentVersion0.
                    setDocument(relatedDocument0);
                }
            
                const relatedDocument1 = await Documents.findOne({
                    offset: Math.floor(Math.random() * (await Documents.count())),
                });
                const DocumentVersion1 = await DocumentVersions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DocumentVersion1?.setDocument)
                {
                    await
                    DocumentVersion1.
                    setDocument(relatedDocument1);
                }
            
                const relatedDocument2 = await Documents.findOne({
                    offset: Math.floor(Math.random() * (await Documents.count())),
                });
                const DocumentVersion2 = await DocumentVersions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DocumentVersion2?.setDocument)
                {
                    await
                    DocumentVersion2.
                    setDocument(relatedDocument2);
                }
            
        }
        
    
        
            
            async function associateDocumentVersionWithUploaded_by() {
            
                const relatedUploaded_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const DocumentVersion0 = await DocumentVersions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DocumentVersion0?.setUploaded_by)
                {
                    await
                    DocumentVersion0.
                    setUploaded_by(relatedUploaded_by0);
                }
            
                const relatedUploaded_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const DocumentVersion1 = await DocumentVersions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DocumentVersion1?.setUploaded_by)
                {
                    await
                    DocumentVersion1.
                    setUploaded_by(relatedUploaded_by1);
                }
            
                const relatedUploaded_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const DocumentVersion2 = await DocumentVersions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DocumentVersion2?.setUploaded_by)
                {
                    await
                    DocumentVersion2.
                    setUploaded_by(relatedUploaded_by2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateDocumentVersionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DocumentVersion0 = await DocumentVersions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DocumentVersion0?.setOrganization)
                {
                    await
                    DocumentVersion0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DocumentVersion1 = await DocumentVersions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DocumentVersion1?.setOrganization)
                {
                    await
                    DocumentVersion1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DocumentVersion2 = await DocumentVersions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DocumentVersion2?.setOrganization)
                {
                    await
                    DocumentVersion2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateAlertWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Alert0 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Alert0?.setCompany)
                {
                    await
                    Alert0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Alert1 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Alert1?.setCompany)
                {
                    await
                    Alert1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Alert2 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Alert2?.setCompany)
                {
                    await
                    Alert2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateAlertWithRelated_compliance() {
            
                const relatedRelated_compliance0 = await CompanyCompliances.findOne({
                    offset: Math.floor(Math.random() * (await CompanyCompliances.count())),
                });
                const Alert0 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Alert0?.setRelated_compliance)
                {
                    await
                    Alert0.
                    setRelated_compliance(relatedRelated_compliance0);
                }
            
                const relatedRelated_compliance1 = await CompanyCompliances.findOne({
                    offset: Math.floor(Math.random() * (await CompanyCompliances.count())),
                });
                const Alert1 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Alert1?.setRelated_compliance)
                {
                    await
                    Alert1.
                    setRelated_compliance(relatedRelated_compliance1);
                }
            
                const relatedRelated_compliance2 = await CompanyCompliances.findOne({
                    offset: Math.floor(Math.random() * (await CompanyCompliances.count())),
                });
                const Alert2 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Alert2?.setRelated_compliance)
                {
                    await
                    Alert2.
                    setRelated_compliance(relatedRelated_compliance2);
                }
            
        }
        
    
        
            
            async function associateAlertWithRelated_task() {
            
                const relatedRelated_task0 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const Alert0 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Alert0?.setRelated_task)
                {
                    await
                    Alert0.
                    setRelated_task(relatedRelated_task0);
                }
            
                const relatedRelated_task1 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const Alert1 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Alert1?.setRelated_task)
                {
                    await
                    Alert1.
                    setRelated_task(relatedRelated_task1);
                }
            
                const relatedRelated_task2 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const Alert2 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Alert2?.setRelated_task)
                {
                    await
                    Alert2.
                    setRelated_task(relatedRelated_task2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateAlertWithRecipient_user() {
            
                const relatedRecipient_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Alert0 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Alert0?.setRecipient_user)
                {
                    await
                    Alert0.
                    setRecipient_user(relatedRecipient_user0);
                }
            
                const relatedRecipient_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Alert1 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Alert1?.setRecipient_user)
                {
                    await
                    Alert1.
                    setRecipient_user(relatedRecipient_user1);
                }
            
                const relatedRecipient_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Alert2 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Alert2?.setRecipient_user)
                {
                    await
                    Alert2.
                    setRecipient_user(relatedRecipient_user2);
                }
            
        }
        
    
        
            
            async function associateAlertWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Alert0 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Alert0?.setOrganization)
                {
                    await
                    Alert0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Alert1 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Alert1?.setOrganization)
                {
                    await
                    Alert1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Alert2 = await Alerts.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Alert2?.setOrganization)
                {
                    await
                    Alert2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCalendarEventWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const CalendarEvent0 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CalendarEvent0?.setCompany)
                {
                    await
                    CalendarEvent0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const CalendarEvent1 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CalendarEvent1?.setCompany)
                {
                    await
                    CalendarEvent1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const CalendarEvent2 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CalendarEvent2?.setCompany)
                {
                    await
                    CalendarEvent2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateCalendarEventWithRelated_compliance() {
            
                const relatedRelated_compliance0 = await CompanyCompliances.findOne({
                    offset: Math.floor(Math.random() * (await CompanyCompliances.count())),
                });
                const CalendarEvent0 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CalendarEvent0?.setRelated_compliance)
                {
                    await
                    CalendarEvent0.
                    setRelated_compliance(relatedRelated_compliance0);
                }
            
                const relatedRelated_compliance1 = await CompanyCompliances.findOne({
                    offset: Math.floor(Math.random() * (await CompanyCompliances.count())),
                });
                const CalendarEvent1 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CalendarEvent1?.setRelated_compliance)
                {
                    await
                    CalendarEvent1.
                    setRelated_compliance(relatedRelated_compliance1);
                }
            
                const relatedRelated_compliance2 = await CompanyCompliances.findOne({
                    offset: Math.floor(Math.random() * (await CompanyCompliances.count())),
                });
                const CalendarEvent2 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CalendarEvent2?.setRelated_compliance)
                {
                    await
                    CalendarEvent2.
                    setRelated_compliance(relatedRelated_compliance2);
                }
            
        }
        
    
        
            
            async function associateCalendarEventWithRelated_task() {
            
                const relatedRelated_task0 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const CalendarEvent0 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CalendarEvent0?.setRelated_task)
                {
                    await
                    CalendarEvent0.
                    setRelated_task(relatedRelated_task0);
                }
            
                const relatedRelated_task1 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const CalendarEvent1 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CalendarEvent1?.setRelated_task)
                {
                    await
                    CalendarEvent1.
                    setRelated_task(relatedRelated_task1);
                }
            
                const relatedRelated_task2 = await Tasks.findOne({
                    offset: Math.floor(Math.random() * (await Tasks.count())),
                });
                const CalendarEvent2 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CalendarEvent2?.setRelated_task)
                {
                    await
                    CalendarEvent2.
                    setRelated_task(relatedRelated_task2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCalendarEventWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CalendarEvent0 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CalendarEvent0?.setOrganization)
                {
                    await
                    CalendarEvent0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CalendarEvent1 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CalendarEvent1?.setOrganization)
                {
                    await
                    CalendarEvent1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CalendarEvent2 = await CalendarEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CalendarEvent2?.setOrganization)
                {
                    await
                    CalendarEvent2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateSubscriptionPlanWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SubscriptionPlan0 = await SubscriptionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SubscriptionPlan0?.setOrganization)
                {
                    await
                    SubscriptionPlan0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SubscriptionPlan1 = await SubscriptionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SubscriptionPlan1?.setOrganization)
                {
                    await
                    SubscriptionPlan1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SubscriptionPlan2 = await SubscriptionPlans.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SubscriptionPlan2?.setOrganization)
                {
                    await
                    SubscriptionPlan2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateCompanySubscriptionWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const CompanySubscription0 = await CompanySubscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CompanySubscription0?.setCompany)
                {
                    await
                    CompanySubscription0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const CompanySubscription1 = await CompanySubscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CompanySubscription1?.setCompany)
                {
                    await
                    CompanySubscription1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const CompanySubscription2 = await CompanySubscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CompanySubscription2?.setCompany)
                {
                    await
                    CompanySubscription2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateCompanySubscriptionWithPlan() {
            
                const relatedPlan0 = await SubscriptionPlans.findOne({
                    offset: Math.floor(Math.random() * (await SubscriptionPlans.count())),
                });
                const CompanySubscription0 = await CompanySubscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CompanySubscription0?.setPlan)
                {
                    await
                    CompanySubscription0.
                    setPlan(relatedPlan0);
                }
            
                const relatedPlan1 = await SubscriptionPlans.findOne({
                    offset: Math.floor(Math.random() * (await SubscriptionPlans.count())),
                });
                const CompanySubscription1 = await CompanySubscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CompanySubscription1?.setPlan)
                {
                    await
                    CompanySubscription1.
                    setPlan(relatedPlan1);
                }
            
                const relatedPlan2 = await SubscriptionPlans.findOne({
                    offset: Math.floor(Math.random() * (await SubscriptionPlans.count())),
                });
                const CompanySubscription2 = await CompanySubscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CompanySubscription2?.setPlan)
                {
                    await
                    CompanySubscription2.
                    setPlan(relatedPlan2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateCompanySubscriptionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CompanySubscription0 = await CompanySubscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (CompanySubscription0?.setOrganization)
                {
                    await
                    CompanySubscription0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CompanySubscription1 = await CompanySubscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (CompanySubscription1?.setOrganization)
                {
                    await
                    CompanySubscription1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const CompanySubscription2 = await CompanySubscriptions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (CompanySubscription2?.setOrganization)
                {
                    await
                    CompanySubscription2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associatePaymentWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setCompany)
                {
                    await
                    Payment0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setCompany)
                {
                    await
                    Payment1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setCompany)
                {
                    await
                    Payment2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associatePaymentWithCompany_subscription() {
            
                const relatedCompany_subscription0 = await CompanySubscriptions.findOne({
                    offset: Math.floor(Math.random() * (await CompanySubscriptions.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setCompany_subscription)
                {
                    await
                    Payment0.
                    setCompany_subscription(relatedCompany_subscription0);
                }
            
                const relatedCompany_subscription1 = await CompanySubscriptions.findOne({
                    offset: Math.floor(Math.random() * (await CompanySubscriptions.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setCompany_subscription)
                {
                    await
                    Payment1.
                    setCompany_subscription(relatedCompany_subscription1);
                }
            
                const relatedCompany_subscription2 = await CompanySubscriptions.findOne({
                    offset: Math.floor(Math.random() * (await CompanySubscriptions.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setCompany_subscription)
                {
                    await
                    Payment2.
                    setCompany_subscription(relatedCompany_subscription2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associatePaymentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment0 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Payment0?.setOrganization)
                {
                    await
                    Payment0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment1 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Payment1?.setOrganization)
                {
                    await
                    Payment1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Payment2 = await Payments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Payment2?.setOrganization)
                {
                    await
                    Payment2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateAiChatSessionWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const AiChatSession0 = await AiChatSessions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiChatSession0?.setCompany)
                {
                    await
                    AiChatSession0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const AiChatSession1 = await AiChatSessions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiChatSession1?.setCompany)
                {
                    await
                    AiChatSession1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const AiChatSession2 = await AiChatSessions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiChatSession2?.setCompany)
                {
                    await
                    AiChatSession2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateAiChatSessionWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AiChatSession0 = await AiChatSessions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiChatSession0?.setUser)
                {
                    await
                    AiChatSession0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AiChatSession1 = await AiChatSessions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiChatSession1?.setUser)
                {
                    await
                    AiChatSession1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AiChatSession2 = await AiChatSessions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiChatSession2?.setUser)
                {
                    await
                    AiChatSession2.
                    setUser(relatedUser2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateAiChatSessionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiChatSession0 = await AiChatSessions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiChatSession0?.setOrganization)
                {
                    await
                    AiChatSession0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiChatSession1 = await AiChatSessions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiChatSession1?.setOrganization)
                {
                    await
                    AiChatSession1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiChatSession2 = await AiChatSessions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiChatSession2?.setOrganization)
                {
                    await
                    AiChatSession2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateAiChatMessageWithSession() {
            
                const relatedSession0 = await AiChatSessions.findOne({
                    offset: Math.floor(Math.random() * (await AiChatSessions.count())),
                });
                const AiChatMessage0 = await AiChatMessages.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiChatMessage0?.setSession)
                {
                    await
                    AiChatMessage0.
                    setSession(relatedSession0);
                }
            
                const relatedSession1 = await AiChatSessions.findOne({
                    offset: Math.floor(Math.random() * (await AiChatSessions.count())),
                });
                const AiChatMessage1 = await AiChatMessages.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiChatMessage1?.setSession)
                {
                    await
                    AiChatMessage1.
                    setSession(relatedSession1);
                }
            
                const relatedSession2 = await AiChatSessions.findOne({
                    offset: Math.floor(Math.random() * (await AiChatSessions.count())),
                });
                const AiChatMessage2 = await AiChatMessages.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiChatMessage2?.setSession)
                {
                    await
                    AiChatMessage2.
                    setSession(relatedSession2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateAiChatMessageWithCreated_by_user() {
            
                const relatedCreated_by_user0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AiChatMessage0 = await AiChatMessages.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiChatMessage0?.setCreated_by_user)
                {
                    await
                    AiChatMessage0.
                    setCreated_by_user(relatedCreated_by_user0);
                }
            
                const relatedCreated_by_user1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AiChatMessage1 = await AiChatMessages.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiChatMessage1?.setCreated_by_user)
                {
                    await
                    AiChatMessage1.
                    setCreated_by_user(relatedCreated_by_user1);
                }
            
                const relatedCreated_by_user2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const AiChatMessage2 = await AiChatMessages.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiChatMessage2?.setCreated_by_user)
                {
                    await
                    AiChatMessage2.
                    setCreated_by_user(relatedCreated_by_user2);
                }
            
        }
        
    
        
            
            async function associateAiChatMessageWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiChatMessage0 = await AiChatMessages.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiChatMessage0?.setOrganization)
                {
                    await
                    AiChatMessage0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiChatMessage1 = await AiChatMessages.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiChatMessage1?.setOrganization)
                {
                    await
                    AiChatMessage1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiChatMessage2 = await AiChatMessages.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiChatMessage2?.setOrganization)
                {
                    await
                    AiChatMessage2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateAuditLogWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const AuditLog0 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AuditLog0?.setCompany)
                {
                    await
                    AuditLog0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const AuditLog1 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AuditLog1?.setCompany)
                {
                    await
                    AuditLog1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const AuditLog2 = await AuditLogs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AuditLog2?.setCompany)
                {
                    await
                    AuditLog2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            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 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 associateActivityEventWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ActivityEvent0 = await ActivityEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ActivityEvent0?.setCompany)
                {
                    await
                    ActivityEvent0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ActivityEvent1 = await ActivityEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ActivityEvent1?.setCompany)
                {
                    await
                    ActivityEvent1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ActivityEvent2 = await ActivityEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ActivityEvent2?.setCompany)
                {
                    await
                    ActivityEvent2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateActivityEventWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ActivityEvent0 = await ActivityEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ActivityEvent0?.setUser)
                {
                    await
                    ActivityEvent0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ActivityEvent1 = await ActivityEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ActivityEvent1?.setUser)
                {
                    await
                    ActivityEvent1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ActivityEvent2 = await ActivityEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ActivityEvent2?.setUser)
                {
                    await
                    ActivityEvent2.
                    setUser(relatedUser2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateActivityEventWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ActivityEvent0 = await ActivityEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ActivityEvent0?.setOrganization)
                {
                    await
                    ActivityEvent0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ActivityEvent1 = await ActivityEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ActivityEvent1?.setOrganization)
                {
                    await
                    ActivityEvent1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ActivityEvent2 = await ActivityEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ActivityEvent2?.setOrganization)
                {
                    await
                    ActivityEvent2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateReportExportWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ReportExport0 = await ReportExports.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReportExport0?.setCompany)
                {
                    await
                    ReportExport0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ReportExport1 = await ReportExports.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReportExport1?.setCompany)
                {
                    await
                    ReportExport1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ReportExport2 = await ReportExports.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReportExport2?.setCompany)
                {
                    await
                    ReportExport2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateReportExportWithRequested_by() {
            
                const relatedRequested_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ReportExport0 = await ReportExports.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReportExport0?.setRequested_by)
                {
                    await
                    ReportExport0.
                    setRequested_by(relatedRequested_by0);
                }
            
                const relatedRequested_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ReportExport1 = await ReportExports.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReportExport1?.setRequested_by)
                {
                    await
                    ReportExport1.
                    setRequested_by(relatedRequested_by1);
                }
            
                const relatedRequested_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ReportExport2 = await ReportExports.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReportExport2?.setRequested_by)
                {
                    await
                    ReportExport2.
                    setRequested_by(relatedRequested_by2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateReportExportWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ReportExport0 = await ReportExports.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ReportExport0?.setOrganization)
                {
                    await
                    ReportExport0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ReportExport1 = await ReportExports.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ReportExport1?.setOrganization)
                {
                    await
                    ReportExport1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ReportExport2 = await ReportExports.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ReportExport2?.setOrganization)
                {
                    await
                    ReportExport2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateComplianceRuleOverrideWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ComplianceRuleOverride0 = await ComplianceRuleOverrides.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ComplianceRuleOverride0?.setCompany)
                {
                    await
                    ComplianceRuleOverride0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ComplianceRuleOverride1 = await ComplianceRuleOverrides.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ComplianceRuleOverride1?.setCompany)
                {
                    await
                    ComplianceRuleOverride1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const ComplianceRuleOverride2 = await ComplianceRuleOverrides.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ComplianceRuleOverride2?.setCompany)
                {
                    await
                    ComplianceRuleOverride2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateComplianceRuleOverrideWithTemplate() {
            
                const relatedTemplate0 = await ComplianceTemplates.findOne({
                    offset: Math.floor(Math.random() * (await ComplianceTemplates.count())),
                });
                const ComplianceRuleOverride0 = await ComplianceRuleOverrides.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ComplianceRuleOverride0?.setTemplate)
                {
                    await
                    ComplianceRuleOverride0.
                    setTemplate(relatedTemplate0);
                }
            
                const relatedTemplate1 = await ComplianceTemplates.findOne({
                    offset: Math.floor(Math.random() * (await ComplianceTemplates.count())),
                });
                const ComplianceRuleOverride1 = await ComplianceRuleOverrides.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ComplianceRuleOverride1?.setTemplate)
                {
                    await
                    ComplianceRuleOverride1.
                    setTemplate(relatedTemplate1);
                }
            
                const relatedTemplate2 = await ComplianceTemplates.findOne({
                    offset: Math.floor(Math.random() * (await ComplianceTemplates.count())),
                });
                const ComplianceRuleOverride2 = await ComplianceRuleOverrides.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ComplianceRuleOverride2?.setTemplate)
                {
                    await
                    ComplianceRuleOverride2.
                    setTemplate(relatedTemplate2);
                }
            
        }
        
    
        
            
            async function associateComplianceRuleOverrideWithBranch() {
            
                const relatedBranch0 = await Branches.findOne({
                    offset: Math.floor(Math.random() * (await Branches.count())),
                });
                const ComplianceRuleOverride0 = await ComplianceRuleOverrides.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ComplianceRuleOverride0?.setBranch)
                {
                    await
                    ComplianceRuleOverride0.
                    setBranch(relatedBranch0);
                }
            
                const relatedBranch1 = await Branches.findOne({
                    offset: Math.floor(Math.random() * (await Branches.count())),
                });
                const ComplianceRuleOverride1 = await ComplianceRuleOverrides.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ComplianceRuleOverride1?.setBranch)
                {
                    await
                    ComplianceRuleOverride1.
                    setBranch(relatedBranch1);
                }
            
                const relatedBranch2 = await Branches.findOne({
                    offset: Math.floor(Math.random() * (await Branches.count())),
                });
                const ComplianceRuleOverride2 = await ComplianceRuleOverrides.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ComplianceRuleOverride2?.setBranch)
                {
                    await
                    ComplianceRuleOverride2.
                    setBranch(relatedBranch2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateComplianceRuleOverrideWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ComplianceRuleOverride0 = await ComplianceRuleOverrides.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ComplianceRuleOverride0?.setOrganization)
                {
                    await
                    ComplianceRuleOverride0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ComplianceRuleOverride1 = await ComplianceRuleOverrides.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ComplianceRuleOverride1?.setOrganization)
                {
                    await
                    ComplianceRuleOverride1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ComplianceRuleOverride2 = await ComplianceRuleOverrides.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ComplianceRuleOverride2?.setOrganization)
                {
                    await
                    ComplianceRuleOverride2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateIntegrationWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Integration0 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Integration0?.setCompany)
                {
                    await
                    Integration0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Integration1 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Integration1?.setCompany)
                {
                    await
                    Integration1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const Integration2 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Integration2?.setCompany)
                {
                    await
                    Integration2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateIntegrationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Integration0 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Integration0?.setOrganization)
                {
                    await
                    Integration0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Integration1 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Integration1?.setOrganization)
                {
                    await
                    Integration1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Integration2 = await Integrations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Integration2?.setOrganization)
                {
                    await
                    Integration2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateNotificationsPreferenceWithCompany() {
            
                const relatedCompany0 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const NotificationsPreference0 = await NotificationsPreferences.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (NotificationsPreference0?.setCompany)
                {
                    await
                    NotificationsPreference0.
                    setCompany(relatedCompany0);
                }
            
                const relatedCompany1 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const NotificationsPreference1 = await NotificationsPreferences.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (NotificationsPreference1?.setCompany)
                {
                    await
                    NotificationsPreference1.
                    setCompany(relatedCompany1);
                }
            
                const relatedCompany2 = await Companies.findOne({
                    offset: Math.floor(Math.random() * (await Companies.count())),
                });
                const NotificationsPreference2 = await NotificationsPreferences.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (NotificationsPreference2?.setCompany)
                {
                    await
                    NotificationsPreference2.
                    setCompany(relatedCompany2);
                }
            
        }
        
    
        
            
            async function associateNotificationsPreferenceWithUser() {
            
                const relatedUser0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const NotificationsPreference0 = await NotificationsPreferences.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (NotificationsPreference0?.setUser)
                {
                    await
                    NotificationsPreference0.
                    setUser(relatedUser0);
                }
            
                const relatedUser1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const NotificationsPreference1 = await NotificationsPreferences.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (NotificationsPreference1?.setUser)
                {
                    await
                    NotificationsPreference1.
                    setUser(relatedUser1);
                }
            
                const relatedUser2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const NotificationsPreference2 = await NotificationsPreferences.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (NotificationsPreference2?.setUser)
                {
                    await
                    NotificationsPreference2.
                    setUser(relatedUser2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateNotificationsPreferenceWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const NotificationsPreference0 = await NotificationsPreferences.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (NotificationsPreference0?.setOrganization)
                {
                    await
                    NotificationsPreference0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const NotificationsPreference1 = await NotificationsPreferences.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (NotificationsPreference1?.setOrganization)
                {
                    await
                    NotificationsPreference1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const NotificationsPreference2 = await NotificationsPreferences.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (NotificationsPreference2?.setOrganization)
                {
                    await
                    NotificationsPreference2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Organizations.bulkCreate(OrganizationsData);
                
            
            
                
                await Companies.bulkCreate(CompaniesData);
                
            
            
                
                await CompanyMemberships.bulkCreate(CompanyMembershipsData);
                
            
            
                
                await Branches.bulkCreate(BranchesData);
                
            
            
                
                await Departments.bulkCreate(DepartmentsData);
                
            
            
                
                await ComplianceCategories.bulkCreate(ComplianceCategoriesData);
                
            
            
                
                await ComplianceTemplates.bulkCreate(ComplianceTemplatesData);
                
            
            
                
                await CompanyCompliances.bulkCreate(CompanyCompliancesData);
                
            
            
                
                await Tasks.bulkCreate(TasksData);
                
            
            
                
                await Documents.bulkCreate(DocumentsData);
                
            
            
                
                await DocumentVersions.bulkCreate(DocumentVersionsData);
                
            
            
                
                await Alerts.bulkCreate(AlertsData);
                
            
            
                
                await CalendarEvents.bulkCreate(CalendarEventsData);
                
            
            
                
                await SubscriptionPlans.bulkCreate(SubscriptionPlansData);
                
            
            
                
                await CompanySubscriptions.bulkCreate(CompanySubscriptionsData);
                
            
            
                
                await Payments.bulkCreate(PaymentsData);
                
            
            
                
                await AiChatSessions.bulkCreate(AiChatSessionsData);
                
            
            
                
                await AiChatMessages.bulkCreate(AiChatMessagesData);
                
            
            
                
                await AuditLogs.bulkCreate(AuditLogsData);
                
            
            
                
                await ActivityEvents.bulkCreate(ActivityEventsData);
                
            
            
                
                await ReportExports.bulkCreate(ReportExportsData);
                
            
            
                
                await ComplianceRuleOverrides.bulkCreate(ComplianceRuleOverridesData);
                
            
            
                
                await Integrations.bulkCreate(IntegrationsData);
                
            
            
                
                await NotificationsPreferences.bulkCreate(NotificationsPreferencesData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateUserWithOrganization(),
                    
                
            
                
                
                
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCompanyWithOwner_user(),
                    
                
                    
                        
                        await associateCompanyWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCompanyMembershipWithCompany(),
                    
                
                    
                        
                        await associateCompanyMembershipWithUser(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCompanyMembershipWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateBrancheWithCompany(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateBrancheWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateDepartmentWithCompany(),
                    
                
                    
                
                    
                
                    
                        
                        await associateDepartmentWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        
                        await associateComplianceCategoryWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateComplianceTemplateWithCategory(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateComplianceTemplateWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCompanyComplianceWithCompany(),
                    
                
                    
                        
                        await associateCompanyComplianceWithTemplate(),
                    
                
                    
                        
                        await associateCompanyComplianceWithBranch(),
                    
                
                    
                        
                        await associateCompanyComplianceWithDepartment(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCompanyComplianceWithAssigned_to(),
                    
                
                    
                        
                        await associateCompanyComplianceWithCreated_by_user(),
                    
                
                    
                        
                        await associateCompanyComplianceWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateTaskWithCompany(),
                    
                
                    
                        
                        await associateTaskWithRelated_compliance(),
                    
                
                    
                        
                        await associateTaskWithBranch(),
                    
                
                    
                        
                        await associateTaskWithDepartment(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateTaskWithAssignee(),
                    
                
                    
                        
                        await associateTaskWithReporter(),
                    
                
                    
                
                    
                
                    
                        
                        await associateTaskWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateDocumentWithCompany(),
                    
                
                    
                        
                        await associateDocumentWithBranch(),
                    
                
                    
                        
                        await associateDocumentWithRelated_compliance(),
                    
                
                    
                        
                        await associateDocumentWithUploaded_by(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDocumentWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateDocumentVersionWithDocument(),
                    
                
                    
                        
                        await associateDocumentVersionWithUploaded_by(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateDocumentVersionWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateAlertWithCompany(),
                    
                
                    
                        
                        await associateAlertWithRelated_compliance(),
                    
                
                    
                        
                        await associateAlertWithRelated_task(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateAlertWithRecipient_user(),
                    
                
                    
                        
                        await associateAlertWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCalendarEventWithCompany(),
                    
                
                    
                        
                        await associateCalendarEventWithRelated_compliance(),
                    
                
                    
                        
                        await associateCalendarEventWithRelated_task(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCalendarEventWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSubscriptionPlanWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateCompanySubscriptionWithCompany(),
                    
                
                    
                        
                        await associateCompanySubscriptionWithPlan(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateCompanySubscriptionWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associatePaymentWithCompany(),
                    
                
                    
                        
                        await associatePaymentWithCompany_subscription(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associatePaymentWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateAiChatSessionWithCompany(),
                    
                
                    
                        
                        await associateAiChatSessionWithUser(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateAiChatSessionWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateAiChatMessageWithSession(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateAiChatMessageWithCreated_by_user(),
                    
                
                    
                        
                        await associateAiChatMessageWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateAuditLogWithCompany(),
                    
                
                    
                        
                        await associateAuditLogWithActor_user(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateAuditLogWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateActivityEventWithCompany(),
                    
                
                    
                        
                        await associateActivityEventWithUser(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateActivityEventWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateReportExportWithCompany(),
                    
                
                    
                        
                        await associateReportExportWithRequested_by(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateReportExportWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateComplianceRuleOverrideWithCompany(),
                    
                
                    
                        
                        await associateComplianceRuleOverrideWithTemplate(),
                    
                
                    
                        
                        await associateComplianceRuleOverrideWithBranch(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateComplianceRuleOverrideWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateIntegrationWithCompany(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateIntegrationWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateNotificationsPreferenceWithCompany(),
                    
                
                    
                        
                        await associateNotificationsPreferenceWithUser(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateNotificationsPreferenceWithOrganization(),
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('organizations', null, {});
            
            
            await queryInterface.bulkDelete('companies', null, {});
            
            
            await queryInterface.bulkDelete('company_memberships', null, {});
            
            
            await queryInterface.bulkDelete('branches', null, {});
            
            
            await queryInterface.bulkDelete('departments', null, {});
            
            
            await queryInterface.bulkDelete('compliance_categories', null, {});
            
            
            await queryInterface.bulkDelete('compliance_templates', null, {});
            
            
            await queryInterface.bulkDelete('company_compliances', null, {});
            
            
            await queryInterface.bulkDelete('tasks', null, {});
            
            
            await queryInterface.bulkDelete('documents', null, {});
            
            
            await queryInterface.bulkDelete('document_versions', null, {});
            
            
            await queryInterface.bulkDelete('alerts', null, {});
            
            
            await queryInterface.bulkDelete('calendar_events', null, {});
            
            
            await queryInterface.bulkDelete('subscription_plans', null, {});
            
            
            await queryInterface.bulkDelete('company_subscriptions', null, {});
            
            
            await queryInterface.bulkDelete('payments', null, {});
            
            
            await queryInterface.bulkDelete('ai_chat_sessions', null, {});
            
            
            await queryInterface.bulkDelete('ai_chat_messages', null, {});
            
            
            await queryInterface.bulkDelete('audit_logs', null, {});
            
            
            await queryInterface.bulkDelete('activity_events', null, {});
            
            
            await queryInterface.bulkDelete('report_exports', null, {});
            
            
            await queryInterface.bulkDelete('compliance_rule_overrides', null, {});
            
            
            await queryInterface.bulkDelete('integrations', null, {});
            
            
            await queryInterface.bulkDelete('notifications_preferences', null, {});
            
        
    },
};