





















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






const Organizations = db.organizations;

const Assets = db.assets;

const DataSources = db.data_sources;

const IngestionPipelines = db.ingestion_pipelines;

const TelemetryEvents = db.telemetry_events;

const AiModels = db.ai_models;

const Detections = db.detections;

const Incidents = db.incidents;

const ResponsePlaybooks = db.response_playbooks;

const ResponseActions = db.response_actions;

const SocAgents = db.soc_agents;

const ThreatActors = db.threat_actors;

const ThreatIndicators = db.threat_indicators;

const ThreatCampaigns = db.threat_campaigns;

const AttackMapEvents = db.attack_map_events;

const RiskAssessments = db.risk_assessments;

const SimulationLabs = db.simulation_labs;

const SimulationRuns = db.simulation_runs;

const InfrastructureClusters = db.infrastructure_clusters;

const EdgeSensors = db.edge_sensors;

const Reports = db.reports;

const AiRecommendations = db.ai_recommendations;







const OrganizationsData = [
    
    {
    
        
        
            
                "name": "Apex National Bank",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Northbridge Health Systems",
            
        
    
    },
    
    {
    
        
        
            
                "name": "Ministry of Transport Digital",
            
        
    
    },
    
];



const AssetsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Core Banking API",
            
        
    
        
        
            
                "asset_type": "host",
            
        
    
        
        
            
                "environment": "production",
            
        
    
        
        
            
                "ip_address": "10.20.5.14",
            
        
    
        
        
            
                "hostname": "corebank-api-01",
            
        
    
        
        
            
                "os": "Linux",
            
        
    
        
        
            
                "cloud_provider": "AWS",
            
        
    
        
        
            
                "criticality": "low",
            
        
    
        
        
            
                "internet_exposed": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Customer Web Portal",
            
        
    
        
        
            
                "asset_type": "workstation",
            
        
    
        
        
            
                "environment": "production",
            
        
    
        
        
            
                "ip_address": "10.20.8.21",
            
        
    
        
        
            
                "hostname": "cust-portal-01",
            
        
    
        
        
            
                "os": "Linux",
            
        
    
        
        
            
                "cloud_provider": "AWS",
            
        
    
        
        
            
                "criticality": "medium",
            
        
    
        
        
            
                "internet_exposed": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "EHR Database",
            
        
    
        
        
            
                "asset_type": "server",
            
        
    
        
        
            
                "environment": "production",
            
        
    
        
        
            
                "ip_address": "10.30.2.10",
            
        
    
        
        
            
                "hostname": "ehr-db-01",
            
        
    
        
        
            
                "os": "Linux",
            
        
    
        
        
            
                "cloud_provider": "Azure",
            
        
    
        
        
            
                "criticality": "low",
            
        
    
        
        
            
                "internet_exposed": false,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const DataSourcesData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Apex EDR Tenant",
            
        
    
        
        
            
                "source_type": "siem",
            
        
    
        
        
            
                "status": "onboarding",
            
        
    
        
        
            
                "connector_type": "crowdstrike",
            
        
    
        
        
            
                "endpoint_url": "https://api.edr.example/apex",
            
        
    
        
        
            
                "auth_method": "oauth2",
            
        
    
        
        
            
                "poll_interval_seconds": 60,
            
        
    
        
        
            
                "last_ingested_at": new Date('2026-03-07T15:09:30Z'),
            
        
    
        
        
            
                "notes": "Endpoint telemetry from corporate workstations",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Apex Firewall Logs",
            
        
    
        
        
            
                "source_type": "edr",
            
        
    
        
        
            
                "status": "error",
            
        
    
        
        
            
                "connector_type": "syslog",
            
        
    
        
        
            
                "endpoint_url": "udp://logs.apexbank.com:514",
            
        
    
        
        
            
                "auth_method": "none",
            
        
    
        
        
            
                "poll_interval_seconds": 0,
            
        
    
        
        
            
                "last_ingested_at": new Date('2026-03-07T15:09:10Z'),
            
        
    
        
        
            
                "notes": "Perimeter firewall syslog stream",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Northbridge O365 Email Gateway",
            
        
    
        
        
            
                "source_type": "cloud_logs",
            
        
    
        
        
            
                "status": "error",
            
        
    
        
        
            
                "connector_type": "microsoft_graph",
            
        
    
        
        
            
                "endpoint_url": "https://graph.microsoft.com",
            
        
    
        
        
            
                "auth_method": "oauth2",
            
        
    
        
        
            
                "poll_interval_seconds": 120,
            
        
    
        
        
            
                "last_ingested_at": new Date('2026-03-07T15:07:55Z'),
            
        
    
        
        
            
                "notes": "Mail flow and phishing signals",
            
        
    
    },
    
];



const IngestionPipelinesData = [
    
    {
    
        
        
            
                "name": "Kafka Stream NA-Logs",
            
        
    
        
        
            
                "pipeline_type": "webhook",
            
        
    
        
        
            
                "status": "degraded",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                "kafka_topic": "na.security.logs",
            
        
    
        
        
            
                "data_lake_path": "s3://cybershield-datalake/na/logs/",
            
        
    
        
        
            
                "throughput_eps": 18500.0,
            
        
    
        
        
            
                "error_rate_percent": 0.3,
            
        
    
        
        
            
                "last_health_check_at": new Date('2026-03-07T15:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Collector O365-Mail",
            
        
    
        
        
            
                "pipeline_type": "kafka_stream",
            
        
    
        
        
            
                "status": "healthy",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                "kafka_topic": "mail.security.events",
            
        
    
        
        
            
                "data_lake_path": "s3://cybershield-datalake/mail/events/",
            
        
    
        
        
            
                "throughput_eps": 2400.0,
            
        
    
        
        
            
                "error_rate_percent": 0.2,
            
        
    
        
        
            
                "last_health_check_at": new Date('2026-03-07T15:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Webhook K8s-Audit",
            
        
    
        
        
            
                "pipeline_type": "file_drop",
            
        
    
        
        
            
                "status": "down",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                "kafka_topic": "k8s.audit.events",
            
        
    
        
        
            
                "data_lake_path": "s3://cybershield-datalake/k8s/audit/",
            
        
    
        
        
            
                "throughput_eps": 3200.0,
            
        
    
        
        
            
                "error_rate_percent": 0.4,
            
        
    
        
        
            
                "last_health_check_at": new Date('2026-03-07T15:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const TelemetryEventsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "observed_at": new Date('2026-03-07T15:01:12Z'),
            
        
    
        
        
            
                "event_type": "email",
            
        
    
        
        
            
                "severity": "medium",
            
        
    
        
        
            
                "summary": "Multiple failed connections to admin endpoint",
            
        
    
        
        
            
                "raw_payload": "src=198.51.100.24 dst=203.0.113.10 path=/admin/login status=401 count=35",
            
        
    
        
        
            
                "hash": "evt-7f3a1c2b",
            
        
    
        
        
            
                "flagged": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "observed_at": new Date('2026-03-07T14:58:44Z'),
            
        
    
        
        
            
                "event_type": "cloud",
            
        
    
        
        
            
                "severity": "informational",
            
        
    
        
        
            
                "summary": "Suspicious process spawned from service account",
            
        
    
        
        
            
                "raw_payload": "proc=cmd.exe parent=svc_host user=svc_api args=/c powershell -enc ...",
            
        
    
        
        
            
                "hash": "evt-91b0d7aa",
            
        
    
        
        
            
                "flagged": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "observed_at": new Date('2026-03-07T14:55:09Z'),
            
        
    
        
        
            
                "event_type": "iam",
            
        
    
        
        
            
                "severity": "low",
            
        
    
        
        
            
                "summary": "Inbound email with credential harvesting link",
            
        
    
        
        
            
                "raw_payload": "from=payroll-update@external.example subject=Action required url=https://login-secure.example/nbh",
            
        
    
        
        
            
                "hash": "evt-0c7d2e11",
            
        
    
        
        
            
                "flagged": true,
            
        
    
    },
    
];



const AiModelsData = [
    
    {
    
        
        
            
                "name": "AnomalyNet Stream v2",
            
        
    
        
        
            
                "model_type": "risk_scoring",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "version": "2.1.0",
            
        
    
        
        
            
                "framework": "PyTorch",
            
        
    
        
        
            
                "artifact_uri": "s3://cybershield-models/anomalynet/2.1.0/model.pt",
            
        
    
        
        
            
                "threshold": 0.78,
            
        
    
        
        
            
                "trained_at": new Date('2026-02-10T11:30:00Z'),
            
        
    
        
        
            
                "activated_at": new Date('2026-02-12T09:00:00Z'),
            
        
    
        
        
            
                "description": "Streaming anomaly detection for auth and network behaviors",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "MalwareVision CNN v3",
            
        
    
        
        
            
                "model_type": "risk_scoring",
            
        
    
        
        
            
                "status": "deprecated",
            
        
    
        
        
            
                "version": "3.0.2",
            
        
    
        
        
            
                "framework": "TensorFlow",
            
        
    
        
        
            
                "artifact_uri": "s3://cybershield-models/malwarevision/3.0.2/model.h5",
            
        
    
        
        
            
                "threshold": 0.84,
            
        
    
        
        
            
                "trained_at": new Date('2026-01-28T16:00:00Z'),
            
        
    
        
        
            
                "activated_at": new Date('2026-02-02T10:00:00Z'),
            
        
    
        
        
            
                "description": "Malware family classification from static features",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "PhishGuard NLP v1",
            
        
    
        
        
            
                "model_type": "soc_agent_policy",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "version": "1.4.5",
            
        
    
        
        
            
                "framework": "Transformers",
            
        
    
        
        
            
                "artifact_uri": "s3://cybershield-models/phishguard/1.4.5/model.bin",
            
        
    
        
        
            
                "threshold": 0.73,
            
        
    
        
        
            
                "trained_at": new Date('2026-02-05T13:00:00Z'),
            
        
    
        
        
            
                "activated_at": new Date('2026-02-06T09:00:00Z'),
            
        
    
        
        
            
                "description": "Email and URL phishing detection with explainability",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const DetectionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "detected_at": new Date('2026-03-07T15:01:20Z'),
            
        
    
        
        
            
                "detection_type": "anomaly",
            
        
    
        
        
            
                "status": "confirmed",
            
        
    
        
        
            
                "confidence": 0.81,
            
        
    
        
        
            
                "risk_score": 72.0,
            
        
    
        
        
            
                "title": "Anomalous admin endpoint probing",
            
        
    
        
        
            
                "evidence": "Spike in 401 responses and unusual source ASN for portal admin route",
            
        
    
        
        
            
                "requires_response": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "detected_at": new Date('2026-03-07T14:59:10Z'),
            
        
    
        
        
            
                "detection_type": "data_exfiltration",
            
        
    
        
        
            
                "status": "confirmed",
            
        
    
        
        
            
                "confidence": 0.88,
            
        
    
        
        
            
                "risk_score": 86.0,
            
        
    
        
        
            
                "title": "Possible living-off-the-land execution on API host",
            
        
    
        
        
            
                "evidence": "Encoded PowerShell execution chain consistent with initial loader behavior",
            
        
    
        
        
            
                "requires_response": true,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "detected_at": new Date('2026-03-07T14:55:20Z'),
            
        
    
        
        
            
                "detection_type": "malware",
            
        
    
        
        
            
                "status": "triaged",
            
        
    
        
        
            
                "confidence": 0.92,
            
        
    
        
        
            
                "risk_score": 90.0,
            
        
    
        
        
            
                "title": "Credential phishing attempt targeting payroll users",
            
        
    
        
        
            
                "evidence": "URL similarity to known kit infrastructure and malicious language features",
            
        
    
        
        
            
                "requires_response": true,
            
        
    
    },
    
];



const IncidentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Portal Admin Probing March 2026",
            
        
    
        
        
            
                "severity": "medium",
            
        
    
        
        
            
                "status": "recovered",
            
        
    
        
        
            
                "opened_at": new Date('2026-03-07T15:02:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-03-08T03:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "summary": "Elevated probing activity against administrative routes; IPs added to watchlist and WAF rules tightened.",
            
        
    
        
        
            
                "business_impact_score": 65.0,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Suspicious Service Account Execution",
            
        
    
        
        
            
                "severity": "high",
            
        
    
        
        
            
                "status": "contained",
            
        
    
        
        
            
                "opened_at": new Date('2026-03-07T15:00:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-03-08T10:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "summary": "Service account activity triggered isolation of affected host and credential rotation while forensic triage runs.",
            
        
    
        
        
            
                "business_impact_score": 92.0,
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Payroll Phishing Campaign",
            
        
    
        
        
            
                "severity": "critical",
            
        
    
        
        
            
                "status": "recovered",
            
        
    
        
        
            
                "opened_at": new Date('2026-03-07T14:56:00Z'),
            
        
    
        
        
            
                "closed_at": new Date('2026-03-09T14:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "summary": "Malicious email campaign blocked; affected users notified; conditional access tightened.",
            
        
    
        
        
            
                "business_impact_score": 70.0,
            
        
    
    },
    
];



const ResponsePlaybooksData = [
    
    {
    
        
        
            
                "name": "Isolate Host and Collect Triage",
            
        
    
        
        
            
                "category": "notification",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "trigger_conditions": "Detection type malware with risk score above 80",
            
        
    
        
        
            
                "steps": "1 Identify affected asset 2 Isolate endpoint 3 Collect memory and triage bundle 4 Open incident ticket 5 Notify on-call",
            
        
    
        
        
            
                "requires_approval": true,
            
        
    
        
        
            
                "expected_duration_minutes": 25.0,
            
        
    
        
        
            
                "description": "Contain suspected compromise while preserving evidence",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Block IP and Harden WAF",
            
        
    
        
        
            
                "category": "containment",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "trigger_conditions": "Anomalous probing against admin paths",
            
        
    
        
        
            
                "steps": "1 Add IP to WAF blocklist 2 Add rate limiting rule 3 Validate logs for spread 4 Add watch query",
            
        
    
        
        
            
                "requires_approval": true,
            
        
    
        
        
            
                "expected_duration_minutes": 15.0,
            
        
    
        
        
            
                "description": "Automated edge blocking for suspicious scanners",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Phishing Takedown and User Notice",
            
        
    
        
        
            
                "category": "notification",
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "trigger_conditions": "Phishing detection confirmed",
            
        
    
        
        
            
                "steps": "1 Quarantine message 2 Block sender and URLs 3 Create user notification 4 Trigger password reset for clicked users",
            
        
    
        
        
            
                "requires_approval": true,
            
        
    
        
        
            
                "expected_duration_minutes": 40.0,
            
        
    
        
        
            
                "description": "Respond to credential phishing with containment and comms",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ResponseActionsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action_type": "restore_backup",
            
        
    
        
        
            
                "status": "succeeded",
            
        
    
        
        
            
                "requested_at": new Date('2026-03-07T15:03:00Z'),
            
        
    
        
        
            
                "executed_at": new Date('2026-03-07T15:03:20Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "target": "198.51.100.24",
            
        
    
        
        
            
                "action_result": "Added to WAF blocklist and rate limiting applied",
            
        
    
        
        
            
                "automated": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action_type": "notify",
            
        
    
        
        
            
                "status": "running",
            
        
    
        
        
            
                "requested_at": new Date('2026-03-07T15:02:00Z'),
            
        
    
        
        
            
                "executed_at": new Date('2026-03-07T15:06:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "target": "corebank-api-01",
            
        
    
        
        
            
                "action_result": "Awaiting manager approval for isolation",
            
        
    
        
        
            
                "automated": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "action_type": "quarantine_file",
            
        
    
        
        
            
                "status": "running",
            
        
    
        
        
            
                "requested_at": new Date('2026-03-07T15:00:00Z'),
            
        
    
        
        
            
                "executed_at": new Date('2026-03-07T15:05:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "target": "Payroll user distribution list",
            
        
    
        
        
            
                "action_result": "Notification draft generated and quarantine in progress",
            
        
    
        
        
            
                "automated": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const SocAgentsData = [
    
    {
    
        
        
            
                "name": "Aegis SOC Agent",
            
        
    
        
        
            
                "agent_type": "automation_engine",
            
        
    
        
        
            
                "status": "online",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "capabilities": "Triage detections, correlate signals, propose actions, execute low-risk playbooks",
            
        
    
        
        
            
                "approval_required_by_default": true,
            
        
    
        
        
            
                "last_heartbeat_at": new Date('2026-03-07T15:09:50Z'),
            
        
    
        
        
            
                "actions_success_rate": 96.4,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "AutoResponse Engine NA",
            
        
    
        
        
            
                "agent_type": "self_healing_network_controller",
            
        
    
        
        
            
                "status": "online",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "capabilities": "Execute WAF blocks, firewall updates, account disables, ticket creation",
            
        
    
        
        
            
                "approval_required_by_default": true,
            
        
    
        
        
            
                "last_heartbeat_at": new Date('2026-03-07T15:09:45Z'),
            
        
    
        
        
            
                "actions_success_rate": 93.1,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "SelfHeal Net Controller",
            
        
    
        
        
            
                "agent_type": "self_healing_network_controller",
            
        
    
        
        
            
                "status": "degraded",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "capabilities": "Network segmentation, route changes, quarantine zones, rollback configs",
            
        
    
        
        
            
                "approval_required_by_default": true,
            
        
    
        
        
            
                "last_heartbeat_at": new Date('2026-03-07T15:00:10Z'),
            
        
    
        
        
            
                "actions_success_rate": 88.7,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ThreatActorsData = [
    
    {
    
        
        
            
                "name": "Silver Hydra",
            
        
    
        
        
            
                "actor_type": "insider",
            
        
    
        
        
            
                "motivation": "unknown",
            
        
    
        
        
            
                "origin_country": "Unknown",
            
        
    
        
        
            
                "aliases": "SH-Group, HydraSil",
            
        
    
        
        
            
                "profile": "Advanced actor targeting government and critical infrastructure with cloud credential theft.",
            
        
    
        
        
            
                "threat_level": 88.0,
            
        
    
        
        
            
                "first_seen_at": new Date('2024-11-12T00:00:00Z'),
            
        
    
        
        
            
                "last_seen_at": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Crimson Ledger",
            
        
    
        
        
            
                "actor_type": "hacktivist",
            
        
    
        
        
            
                "motivation": "unknown",
            
        
    
        
        
            
                "origin_country": "Unknown",
            
        
    
        
        
            
                "aliases": "CL-Collective",
            
        
    
        
        
            
                "profile": "Financially motivated group deploying ransomware via phishing and remote services.",
            
        
    
        
        
            
                "threat_level": 82.0,
            
        
    
        
        
            
                "first_seen_at": new Date('2023-06-04T00:00:00Z'),
            
        
    
        
        
            
                "last_seen_at": new Date('2026-02-25T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Northwind Jackal",
            
        
    
        
        
            
                "actor_type": "insider",
            
        
    
        
        
            
                "motivation": "espionage",
            
        
    
        
        
            
                "origin_country": "Unknown",
            
        
    
        
        
            
                "aliases": "NWJ",
            
        
    
        
        
            
                "profile": "Stealthy operator leveraging supply-chain compromise for long-term persistence.",
            
        
    
        
        
            
                "threat_level": 76.0,
            
        
    
        
        
            
                "first_seen_at": new Date('2022-09-18T00:00:00Z'),
            
        
    
        
        
            
                "last_seen_at": new Date('2026-02-10T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ThreatIndicatorsData = [
    
    {
    
        
        
            
                "indicator_value": "203.0.113.77",
            
        
    
        
        
            
                "indicator_type": "user_agent",
            
        
    
        
        
            
                "confidence": "low",
            
        
    
        
        
            
                "severity": "low",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "first_seen_at": new Date('2026-02-20T00:00:00Z'),
            
        
    
        
        
            
                "last_seen_at": new Date('2026-03-07T00:00:00Z'),
            
        
    
        
        
            
                "source": "Global Threat Feed Premium",
            
        
    
        
        
            
                "context": "Known C2 endpoint associated with ransomware staging.",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "indicator_value": "login-secure.example",
            
        
    
        
        
            
                "indicator_type": "url",
            
        
    
        
        
            
                "confidence": "medium",
            
        
    
        
        
            
                "severity": "low",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "first_seen_at": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "last_seen_at": new Date('2026-03-07T00:00:00Z'),
            
        
    
        
        
            
                "source": "Global Threat Feed Premium",
            
        
    
        
        
            
                "context": "Credential phishing domain used in payroll-themed lures.",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "indicator_value": "198.51.100.24",
            
        
    
        
        
            
                "indicator_type": "certificate",
            
        
    
        
        
            
                "confidence": "low",
            
        
    
        
        
            
                "severity": "medium",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "first_seen_at": new Date('2026-03-05T00:00:00Z'),
            
        
    
        
        
            
                "last_seen_at": new Date('2026-03-07T00:00:00Z'),
            
        
    
        
        
            
                "source": "Internal Observation",
            
        
    
        
        
            
                "context": "Repeated probing of admin endpoints across multiple tenants.",
            
        
    
        
        
            
                "active": true,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ThreatCampaignsData = [
    
    {
    
        
        
            
                "name": "Payroll Refresh 2026",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "dormant",
            
        
    
        
        
            
                "start_at": new Date('2026-02-25T00:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-03-20T00:00:00Z'),
            
        
    
        
        
            
                "summary": "Phishing campaign targeting payroll and HR teams with credential harvesting and MFA fatigue follow-ups.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                "global_risk_score": 78.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Hydra Cloud Token Hunt",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "active",
            
        
    
        
        
            
                "start_at": new Date('2026-01-10T00:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-04-10T00:00:00Z'),
            
        
    
        
        
            
                "summary": "Long-running cloud credential theft with token replay and persistence via OAuth app abuse.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                "global_risk_score": 84.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Public Sector Defacement Wave",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "status": "ended",
            
        
    
        
        
            
                "start_at": new Date('2025-11-01T00:00:00Z'),
            
        
    
        
        
            
                "end_at": new Date('2026-01-15T00:00:00Z'),
            
        
    
        
        
            
                "summary": "Opportunistic scanning and defacement attempts against public-facing portals.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                "global_risk_score": 52.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const AttackMapEventsData = [
    
    {
    
        
        
            
                "occurred_at": new Date('2026-03-07T14:59:00Z'),
            
        
    
        
        
            
                "event_kind": "ransomware",
            
        
    
        
        
            
                "source_country": "Unknown",
            
        
    
        
        
            
                "source_ip": "203.0.113.77",
            
        
    
        
        
            
                "destination_country": "United States",
            
        
    
        
        
            
                "destination_ip": "203.0.113.10",
            
        
    
        
        
            
                "latitude": 40.7128,
            
        
    
        
        
            
                "longitude": -74.006,
            
        
    
        
        
            
                "risk_score": 82.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "occurred_at": new Date('2026-03-07T15:00:30Z'),
            
        
    
        
        
            
                "event_kind": "phishing",
            
        
    
        
        
            
                "source_country": "Unknown",
            
        
    
        
        
            
                "source_ip": "198.51.100.24",
            
        
    
        
        
            
                "destination_country": "United States",
            
        
    
        
        
            
                "destination_ip": "203.0.113.10",
            
        
    
        
        
            
                "latitude": 40.7128,
            
        
    
        
        
            
                "longitude": -74.006,
            
        
    
        
        
            
                "risk_score": 60.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "occurred_at": new Date('2026-03-07T14:53:20Z'),
            
        
    
        
        
            
                "event_kind": "c2_activity",
            
        
    
        
        
            
                "source_country": "Unknown",
            
        
    
        
        
            
                "source_ip": "198.51.100.24",
            
        
    
        
        
            
                "destination_country": "United Kingdom",
            
        
    
        
        
            
                "destination_ip": "203.0.113.55",
            
        
    
        
        
            
                "latitude": 51.5074,
            
        
    
        
        
            
                "longitude": -0.1278,
            
        
    
        
        
            
                "risk_score": 58.0,
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const RiskAssessmentsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "assessed_at": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "scope": "business_unit",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "overall_risk_score": 78.0,
            
        
    
        
        
            
                "risk_level": "medium",
            
        
    
        
        
            
                "top_risks": "Credential abuse exposure, elevated attack surface on web entry points, high-value APIs.",
            
        
    
        
        
            
                "recommendations": "Enforce privileged access management, strengthen WAF rules, add continuous service account monitoring.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "assessed_at": new Date('2026-03-02T00:00:00Z'),
            
        
    
        
        
            
                "scope": "organization",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "overall_risk_score": 82.0,
            
        
    
        
        
            
                "risk_level": "low",
            
        
    
        
        
            
                "top_risks": "Phishing-driven credential compromise, lateral movement to sensitive data stores.",
            
        
    
        
        
            
                "recommendations": "Implement phishing-resistant MFA, restrict admin access paths, increase email security controls.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "assessed_at": new Date('2026-03-03T00:00:00Z'),
            
        
    
        
        
            
                "scope": "asset",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "overall_risk_score": 66.0,
            
        
    
        
        
            
                "risk_level": "critical",
            
        
    
        
        
            
                "top_risks": "Privileged workload creation, misconfigured admission policies, token sprawl.",
            
        
    
        
        
            
                "recommendations": "Harden admission control, rotate service account tokens, enforce least privilege for namespaces.",
            
        
    
    },
    
];



const SimulationLabsData = [
    
    {
    
        
        
            
                "name": "Banking Digital Twin Lab",
            
        
    
        
        
            
                "lab_type": "digital_twin",
            
        
    
        
        
            
                "status": "maintenance",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Digital twin of core banking and portal stack for safe testing of response actions.",
            
        
    
        
        
            
                "created_on": new Date('2026-02-01T10:00:00Z'),
            
        
    
        
        
            
                "max_duration_minutes": 180.0,
            
        
    
    },
    
    {
    
        
        
            
                "name": "Healthcare Phishing Simulation Lab",
            
        
    
        
        
            
                "lab_type": "ai_hacker_simulator",
            
        
    
        
        
            
                "status": "available",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Email and identity attack scenarios to validate training and controls.",
            
        
    
        
        
            
                "created_on": new Date('2026-02-10T10:00:00Z'),
            
        
    
        
        
            
                "max_duration_minutes": 120.0,
            
        
    
    },
    
    {
    
        
        
            
                "name": "GovCloud Attack Simulation Range",
            
        
    
        
        
            
                "lab_type": "ai_hacker_simulator",
            
        
    
        
        
            
                "status": "maintenance",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "description": "Controlled Kubernetes and IAM scenarios for policy validation.",
            
        
    
        
        
            
                "created_on": new Date('2026-01-20T10:00:00Z'),
            
        
    
        
        
            
                "max_duration_minutes": 150.0,
            
        
    
    },
    
];



const SimulationRunsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scenario_type": "ransomware",
            
        
    
        
        
            
                "status": "canceled",
            
        
    
        
        
            
                "started_at": new Date('2026-03-05T09:00:00Z'),
            
        
    
        
        
            
                "ended_at": new Date('2026-03-05T10:20:00Z'),
            
        
    
        
        
            
                "success_score": 84.0,
            
        
    
        
        
            
                "findings": "Isolation action executed successfully; recommended faster credential rotation and improved alert routing.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scenario_type": "ddos",
            
        
    
        
        
            
                "status": "canceled",
            
        
    
        
        
            
                "started_at": new Date('2026-03-04T13:00:00Z'),
            
        
    
        
        
            
                "ended_at": new Date('2026-03-04T14:10:00Z'),
            
        
    
        
        
            
                "success_score": 79.0,
            
        
    
        
        
            
                "findings": "High click rate in test group; AI recommendations prioritized phishing-resistant MFA rollout.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "scenario_type": "lateral_movement",
            
        
    
        
        
            
                "status": "queued",
            
        
    
        
        
            
                "started_at": new Date('2026-03-03T11:00:00Z'),
            
        
    
        
        
            
                "ended_at": new Date('2026-03-03T11:25:00Z'),
            
        
    
        
        
            
                "success_score": 20.0,
            
        
    
        
        
            
                "findings": "Lab service outage prevented full run; schedule retry after maintenance window.",
            
        
    
        
        
            
                // type code here for "relation_many" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const InfrastructureClustersData = [
    
    {
    
        
        
            
                "name": "Kubernetes Control Plane NA-1",
            
        
    
        
        
            
                "cluster_type": "storage_cluster",
            
        
    
        
        
            
                "status": "healthy",
            
        
    
        
        
            
                "region": "us-east-1",
            
        
    
        
        
            
                "provider": "AWS",
            
        
    
        
        
            
                "api_gateway_url": "https://api-na1.cybershield.example",
            
        
    
        
        
            
                "cpu_capacity": 320.0,
            
        
    
        
        
            
                "gpu_capacity": 64.0,
            
        
    
        
        
            
                "storage_capacity_tb": 1200.0,
            
        
    
        
        
            
                "last_audit_at": new Date('2026-02-20T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "GPU Inference Cluster NA-1",
            
        
    
        
        
            
                "cluster_type": "kubernetes",
            
        
    
        
        
            
                "status": "degraded",
            
        
    
        
        
            
                "region": "us-east-1",
            
        
    
        
        
            
                "provider": "AWS",
            
        
    
        
        
            
                "api_gateway_url": "https://gpu-na1.cybershield.example",
            
        
    
        
        
            
                "cpu_capacity": 96.0,
            
        
    
        
        
            
                "gpu_capacity": 128.0,
            
        
    
        
        
            
                "storage_capacity_tb": 400.0,
            
        
    
        
        
            
                "last_audit_at": new Date('2026-02-18T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Distributed Storage EU-1",
            
        
    
        
        
            
                "cluster_type": "gpu_cluster",
            
        
    
        
        
            
                "status": "down",
            
        
    
        
        
            
                "region": "eu-west-1",
            
        
    
        
        
            
                "provider": "Azure",
            
        
    
        
        
            
                "api_gateway_url": "https://storage-eu1.cybershield.example",
            
        
    
        
        
            
                "cpu_capacity": 48.0,
            
        
    
        
        
            
                "gpu_capacity": 0.0,
            
        
    
        
        
            
                "storage_capacity_tb": 2400.0,
            
        
    
        
        
            
                "last_audit_at": new Date('2026-02-25T12:00:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const EdgeSensorsData = [
    
    {
    
        
        
            
                "name": "Edge Sensor NYC-01",
            
        
    
        
        
            
                "status": "offline",
            
        
    
        
        
            
                "location": "New York, NY",
            
        
    
        
        
            
                "site": "ApexBank HQ",
            
        
    
        
        
            
                "hardware_model": "CS-Edge-220",
            
        
    
        
        
            
                "firmware_version": "3.4.1",
            
        
    
        
        
            
                "last_seen_at": new Date('2026-03-07T15:10:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Edge Sensor BOS-02",
            
        
    
        
        
            
                "status": "offline",
            
        
    
        
        
            
                "location": "Boston, MA",
            
        
    
        
        
            
                "site": "Northbridge DC1",
            
        
    
        
        
            
                "hardware_model": "CS-Edge-220",
            
        
    
        
        
            
                "firmware_version": "3.4.1",
            
        
    
        
        
            
                "last_seen_at": new Date('2026-03-07T15:08:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                "name": "Edge Sensor LON-01",
            
        
    
        
        
            
                "status": "degraded",
            
        
    
        
        
            
                "location": "London, UK",
            
        
    
        
        
            
                "site": "MOTD Primary",
            
        
    
        
        
            
                "hardware_model": "CS-Edge-210",
            
        
    
        
        
            
                "firmware_version": "3.3.8",
            
        
    
        
        
            
                "last_seen_at": new Date('2026-03-07T14:58:00Z'),
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const ReportsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Weekly SOC Summary - Week 10",
            
        
    
        
        
            
                "report_type": "executive_summary",
            
        
    
        
        
            
                "status": "published",
            
        
    
        
        
            
                "period_start_at": new Date('2026-03-01T00:00:00Z'),
            
        
    
        
        
            
                "period_end_at": new Date('2026-03-07T23:59:59Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "content": "Summary of key detections, response actions, and risk changes for the reporting period.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Phishing Incident Report - Payroll Refresh",
            
        
    
        
        
            
                "report_type": "incident_report",
            
        
    
        
        
            
                "status": "archived",
            
        
    
        
        
            
                "period_start_at": new Date('2026-03-07T00:00:00Z'),
            
        
    
        
        
            
                "period_end_at": new Date('2026-03-09T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "content": "Incident timeline, impacted users, actions taken, and lessons learned for the phishing campaign.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "name": "Kubernetes Policy Audit Findings",
            
        
    
        
        
            
                "report_type": "monthly_soc_metrics",
            
        
    
        
        
            
                "status": "draft",
            
        
    
        
        
            
                "period_start_at": new Date('2026-02-15T00:00:00Z'),
            
        
    
        
        
            
                "period_end_at": new Date('2026-03-07T00:00:00Z'),
            
        
    
        
        
            
                // type code here for "files" field
            
        
    
        
        
            
                "content": "Review of privileged workload events and recommended policy updates for admission control.",
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
    },
    
];



const AiRecommendationsData = [
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "generated_at": new Date('2026-03-07T15:01:30Z'),
            
        
    
        
        
            
                "recommendation_type": "patching",
            
        
    
        
        
            
                "status": "rejected",
            
        
    
        
        
            
                "estimated_risk_reduction": 18.0,
            
        
    
        
        
            
                "title": "Temporarily isolate API host and restrict egress",
            
        
    
        
        
            
                "details": "Isolate corebank-api-01, restrict outbound traffic to approved destinations, and capture triage bundle.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "generated_at": new Date('2026-03-07T15:02:20Z'),
            
        
    
        
        
            
                "recommendation_type": "hardening",
            
        
    
        
        
            
                "status": "implemented",
            
        
    
        
        
            
                "estimated_risk_reduction": 10.0,
            
        
    
        
        
            
                "title": "Enable adaptive rate limiting on admin routes",
            
        
    
        
        
            
                "details": "Apply rate limits for /admin paths, require step-up authentication, and alert on repeated 401 spikes.",
            
        
    
    },
    
    {
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                // type code here for "relation_one" field
            
        
    
        
        
            
                "generated_at": new Date('2026-03-07T14:56:30Z'),
            
        
    
        
        
            
                "recommendation_type": "containment",
            
        
    
        
        
            
                "status": "implemented",
            
        
    
        
        
            
                "estimated_risk_reduction": 12.0,
            
        
    
        
        
            
                "title": "Run targeted phishing awareness refresh for payroll teams",
            
        
    
        
        
            
                "details": "Schedule focused training and simulated follow-up tests for payroll and HR groups within two weeks.",
            
        
    
    },
    
];




    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // 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 associateAssetWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Asset0 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Asset0?.setOrganization)
                {
                    await
                    Asset0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Asset1 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Asset1?.setOrganization)
                {
                    await
                    Asset1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Asset2 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Asset2?.setOrganization)
                {
                    await
                    Asset2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateAssetWithSensor() {
            
                const relatedSensor0 = await EdgeSensors.findOne({
                    offset: Math.floor(Math.random() * (await EdgeSensors.count())),
                });
                const Asset0 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Asset0?.setSensor)
                {
                    await
                    Asset0.
                    setSensor(relatedSensor0);
                }
            
                const relatedSensor1 = await EdgeSensors.findOne({
                    offset: Math.floor(Math.random() * (await EdgeSensors.count())),
                });
                const Asset1 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Asset1?.setSensor)
                {
                    await
                    Asset1.
                    setSensor(relatedSensor1);
                }
            
                const relatedSensor2 = await EdgeSensors.findOne({
                    offset: Math.floor(Math.random() * (await EdgeSensors.count())),
                });
                const Asset2 = await Assets.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Asset2?.setSensor)
                {
                    await
                    Asset2.
                    setSensor(relatedSensor2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateDataSourceWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DataSource0 = await DataSources.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (DataSource0?.setOrganization)
                {
                    await
                    DataSource0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DataSource1 = await DataSources.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (DataSource1?.setOrganization)
                {
                    await
                    DataSource1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const DataSource2 = await DataSources.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (DataSource2?.setOrganization)
                {
                    await
                    DataSource2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

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

    
    
    
        
            
            async function associateTelemetryEventWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TelemetryEvent0 = await TelemetryEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TelemetryEvent0?.setOrganization)
                {
                    await
                    TelemetryEvent0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TelemetryEvent1 = await TelemetryEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TelemetryEvent1?.setOrganization)
                {
                    await
                    TelemetryEvent1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const TelemetryEvent2 = await TelemetryEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TelemetryEvent2?.setOrganization)
                {
                    await
                    TelemetryEvent2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
            
            async function associateTelemetryEventWithData_source() {
            
                const relatedData_source0 = await DataSources.findOne({
                    offset: Math.floor(Math.random() * (await DataSources.count())),
                });
                const TelemetryEvent0 = await TelemetryEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TelemetryEvent0?.setData_source)
                {
                    await
                    TelemetryEvent0.
                    setData_source(relatedData_source0);
                }
            
                const relatedData_source1 = await DataSources.findOne({
                    offset: Math.floor(Math.random() * (await DataSources.count())),
                });
                const TelemetryEvent1 = await TelemetryEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TelemetryEvent1?.setData_source)
                {
                    await
                    TelemetryEvent1.
                    setData_source(relatedData_source1);
                }
            
                const relatedData_source2 = await DataSources.findOne({
                    offset: Math.floor(Math.random() * (await DataSources.count())),
                });
                const TelemetryEvent2 = await TelemetryEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TelemetryEvent2?.setData_source)
                {
                    await
                    TelemetryEvent2.
                    setData_source(relatedData_source2);
                }
            
        }
        
    
        
            
            async function associateTelemetryEventWithAsset() {
            
                const relatedAsset0 = await Assets.findOne({
                    offset: Math.floor(Math.random() * (await Assets.count())),
                });
                const TelemetryEvent0 = await TelemetryEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (TelemetryEvent0?.setAsset)
                {
                    await
                    TelemetryEvent0.
                    setAsset(relatedAsset0);
                }
            
                const relatedAsset1 = await Assets.findOne({
                    offset: Math.floor(Math.random() * (await Assets.count())),
                });
                const TelemetryEvent1 = await TelemetryEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (TelemetryEvent1?.setAsset)
                {
                    await
                    TelemetryEvent1.
                    setAsset(relatedAsset1);
                }
            
                const relatedAsset2 = await Assets.findOne({
                    offset: Math.floor(Math.random() * (await Assets.count())),
                });
                const TelemetryEvent2 = await TelemetryEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (TelemetryEvent2?.setAsset)
                {
                    await
                    TelemetryEvent2.
                    setAsset(relatedAsset2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateAiModelWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiModel0 = await AiModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiModel0?.setOrganization)
                {
                    await
                    AiModel0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiModel1 = await AiModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiModel1?.setOrganization)
                {
                    await
                    AiModel1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiModel2 = await AiModels.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiModel2?.setOrganization)
                {
                    await
                    AiModel2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateDetectionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Detection0 = await Detections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Detection0?.setOrganization)
                {
                    await
                    Detection0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Detection1 = await Detections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Detection1?.setOrganization)
                {
                    await
                    Detection1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Detection2 = await Detections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Detection2?.setOrganization)
                {
                    await
                    Detection2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
            
            async function associateDetectionWithEvent() {
            
                const relatedEvent0 = await TelemetryEvents.findOne({
                    offset: Math.floor(Math.random() * (await TelemetryEvents.count())),
                });
                const Detection0 = await Detections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Detection0?.setEvent)
                {
                    await
                    Detection0.
                    setEvent(relatedEvent0);
                }
            
                const relatedEvent1 = await TelemetryEvents.findOne({
                    offset: Math.floor(Math.random() * (await TelemetryEvents.count())),
                });
                const Detection1 = await Detections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Detection1?.setEvent)
                {
                    await
                    Detection1.
                    setEvent(relatedEvent1);
                }
            
                const relatedEvent2 = await TelemetryEvents.findOne({
                    offset: Math.floor(Math.random() * (await TelemetryEvents.count())),
                });
                const Detection2 = await Detections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Detection2?.setEvent)
                {
                    await
                    Detection2.
                    setEvent(relatedEvent2);
                }
            
        }
        
    
        
            
            async function associateDetectionWithModel() {
            
                const relatedModel0 = await AiModels.findOne({
                    offset: Math.floor(Math.random() * (await AiModels.count())),
                });
                const Detection0 = await Detections.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Detection0?.setModel)
                {
                    await
                    Detection0.
                    setModel(relatedModel0);
                }
            
                const relatedModel1 = await AiModels.findOne({
                    offset: Math.floor(Math.random() * (await AiModels.count())),
                });
                const Detection1 = await Detections.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Detection1?.setModel)
                {
                    await
                    Detection1.
                    setModel(relatedModel1);
                }
            
                const relatedModel2 = await AiModels.findOne({
                    offset: Math.floor(Math.random() * (await AiModels.count())),
                });
                const Detection2 = await Detections.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Detection2?.setModel)
                {
                    await
                    Detection2.
                    setModel(relatedModel2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateIncidentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Incident0 = await Incidents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Incident0?.setOrganization)
                {
                    await
                    Incident0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Incident1 = await Incidents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Incident1?.setOrganization)
                {
                    await
                    Incident1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Incident2 = await Incidents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Incident2?.setOrganization)
                {
                    await
                    Incident2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateIncidentWithAssignee() {
            
                const relatedAssignee0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Incident0 = await Incidents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Incident0?.setAssignee)
                {
                    await
                    Incident0.
                    setAssignee(relatedAssignee0);
                }
            
                const relatedAssignee1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Incident1 = await Incidents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Incident1?.setAssignee)
                {
                    await
                    Incident1.
                    setAssignee(relatedAssignee1);
                }
            
                const relatedAssignee2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Incident2 = await Incidents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Incident2?.setAssignee)
                {
                    await
                    Incident2.
                    setAssignee(relatedAssignee2);
                }
            
        }
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateResponsePlaybookWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ResponsePlaybook0 = await ResponsePlaybooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ResponsePlaybook0?.setOrganization)
                {
                    await
                    ResponsePlaybook0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ResponsePlaybook1 = await ResponsePlaybooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ResponsePlaybook1?.setOrganization)
                {
                    await
                    ResponsePlaybook1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ResponsePlaybook2 = await ResponsePlaybooks.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ResponsePlaybook2?.setOrganization)
                {
                    await
                    ResponsePlaybook2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateResponseActionWithIncident() {
            
                const relatedIncident0 = await Incidents.findOne({
                    offset: Math.floor(Math.random() * (await Incidents.count())),
                });
                const ResponseAction0 = await ResponseActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ResponseAction0?.setIncident)
                {
                    await
                    ResponseAction0.
                    setIncident(relatedIncident0);
                }
            
                const relatedIncident1 = await Incidents.findOne({
                    offset: Math.floor(Math.random() * (await Incidents.count())),
                });
                const ResponseAction1 = await ResponseActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ResponseAction1?.setIncident)
                {
                    await
                    ResponseAction1.
                    setIncident(relatedIncident1);
                }
            
                const relatedIncident2 = await Incidents.findOne({
                    offset: Math.floor(Math.random() * (await Incidents.count())),
                });
                const ResponseAction2 = await ResponseActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ResponseAction2?.setIncident)
                {
                    await
                    ResponseAction2.
                    setIncident(relatedIncident2);
                }
            
        }
        
    
        
            
            async function associateResponseActionWithPlaybook() {
            
                const relatedPlaybook0 = await ResponsePlaybooks.findOne({
                    offset: Math.floor(Math.random() * (await ResponsePlaybooks.count())),
                });
                const ResponseAction0 = await ResponseActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ResponseAction0?.setPlaybook)
                {
                    await
                    ResponseAction0.
                    setPlaybook(relatedPlaybook0);
                }
            
                const relatedPlaybook1 = await ResponsePlaybooks.findOne({
                    offset: Math.floor(Math.random() * (await ResponsePlaybooks.count())),
                });
                const ResponseAction1 = await ResponseActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ResponseAction1?.setPlaybook)
                {
                    await
                    ResponseAction1.
                    setPlaybook(relatedPlaybook1);
                }
            
                const relatedPlaybook2 = await ResponsePlaybooks.findOne({
                    offset: Math.floor(Math.random() * (await ResponsePlaybooks.count())),
                });
                const ResponseAction2 = await ResponseActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ResponseAction2?.setPlaybook)
                {
                    await
                    ResponseAction2.
                    setPlaybook(relatedPlaybook2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateResponseActionWithRequested_by() {
            
                const relatedRequested_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ResponseAction0 = await ResponseActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ResponseAction0?.setRequested_by)
                {
                    await
                    ResponseAction0.
                    setRequested_by(relatedRequested_by0);
                }
            
                const relatedRequested_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ResponseAction1 = await ResponseActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ResponseAction1?.setRequested_by)
                {
                    await
                    ResponseAction1.
                    setRequested_by(relatedRequested_by1);
                }
            
                const relatedRequested_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const ResponseAction2 = await ResponseActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ResponseAction2?.setRequested_by)
                {
                    await
                    ResponseAction2.
                    setRequested_by(relatedRequested_by2);
                }
            
        }
        
    
        
    
        
    
        
    
        
            
            async function associateResponseActionWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ResponseAction0 = await ResponseActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ResponseAction0?.setOrganization)
                {
                    await
                    ResponseAction0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ResponseAction1 = await ResponseActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ResponseAction1?.setOrganization)
                {
                    await
                    ResponseAction1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ResponseAction2 = await ResponseActions.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ResponseAction2?.setOrganization)
                {
                    await
                    ResponseAction2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
            
            async function associateSocAgentWithModel() {
            
                const relatedModel0 = await AiModels.findOne({
                    offset: Math.floor(Math.random() * (await AiModels.count())),
                });
                const SocAgent0 = await SocAgents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SocAgent0?.setModel)
                {
                    await
                    SocAgent0.
                    setModel(relatedModel0);
                }
            
                const relatedModel1 = await AiModels.findOne({
                    offset: Math.floor(Math.random() * (await AiModels.count())),
                });
                const SocAgent1 = await SocAgents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SocAgent1?.setModel)
                {
                    await
                    SocAgent1.
                    setModel(relatedModel1);
                }
            
                const relatedModel2 = await AiModels.findOne({
                    offset: Math.floor(Math.random() * (await AiModels.count())),
                });
                const SocAgent2 = await SocAgents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SocAgent2?.setModel)
                {
                    await
                    SocAgent2.
                    setModel(relatedModel2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateSocAgentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SocAgent0 = await SocAgents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SocAgent0?.setOrganization)
                {
                    await
                    SocAgent0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SocAgent1 = await SocAgents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SocAgent1?.setOrganization)
                {
                    await
                    SocAgent1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SocAgent2 = await SocAgents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SocAgent2?.setOrganization)
                {
                    await
                    SocAgent2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateThreatActorWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ThreatActor0 = await ThreatActors.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ThreatActor0?.setOrganization)
                {
                    await
                    ThreatActor0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ThreatActor1 = await ThreatActors.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ThreatActor1?.setOrganization)
                {
                    await
                    ThreatActor1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ThreatActor2 = await ThreatActors.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ThreatActor2?.setOrganization)
                {
                    await
                    ThreatActor2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
            
            async function associateThreatIndicatorWithThreat_actor() {
            
                const relatedThreat_actor0 = await ThreatActors.findOne({
                    offset: Math.floor(Math.random() * (await ThreatActors.count())),
                });
                const ThreatIndicator0 = await ThreatIndicators.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ThreatIndicator0?.setThreat_actor)
                {
                    await
                    ThreatIndicator0.
                    setThreat_actor(relatedThreat_actor0);
                }
            
                const relatedThreat_actor1 = await ThreatActors.findOne({
                    offset: Math.floor(Math.random() * (await ThreatActors.count())),
                });
                const ThreatIndicator1 = await ThreatIndicators.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ThreatIndicator1?.setThreat_actor)
                {
                    await
                    ThreatIndicator1.
                    setThreat_actor(relatedThreat_actor1);
                }
            
                const relatedThreat_actor2 = await ThreatActors.findOne({
                    offset: Math.floor(Math.random() * (await ThreatActors.count())),
                });
                const ThreatIndicator2 = await ThreatIndicators.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ThreatIndicator2?.setThreat_actor)
                {
                    await
                    ThreatIndicator2.
                    setThreat_actor(relatedThreat_actor2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateThreatIndicatorWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ThreatIndicator0 = await ThreatIndicators.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ThreatIndicator0?.setOrganization)
                {
                    await
                    ThreatIndicator0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ThreatIndicator1 = await ThreatIndicators.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ThreatIndicator1?.setOrganization)
                {
                    await
                    ThreatIndicator1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ThreatIndicator2 = await ThreatIndicators.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ThreatIndicator2?.setOrganization)
                {
                    await
                    ThreatIndicator2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
    
        
            
            async function associateThreatCampaignWithThreat_actor() {
            
                const relatedThreat_actor0 = await ThreatActors.findOne({
                    offset: Math.floor(Math.random() * (await ThreatActors.count())),
                });
                const ThreatCampaign0 = await ThreatCampaigns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ThreatCampaign0?.setThreat_actor)
                {
                    await
                    ThreatCampaign0.
                    setThreat_actor(relatedThreat_actor0);
                }
            
                const relatedThreat_actor1 = await ThreatActors.findOne({
                    offset: Math.floor(Math.random() * (await ThreatActors.count())),
                });
                const ThreatCampaign1 = await ThreatCampaigns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ThreatCampaign1?.setThreat_actor)
                {
                    await
                    ThreatCampaign1.
                    setThreat_actor(relatedThreat_actor1);
                }
            
                const relatedThreat_actor2 = await ThreatActors.findOne({
                    offset: Math.floor(Math.random() * (await ThreatActors.count())),
                });
                const ThreatCampaign2 = await ThreatCampaigns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ThreatCampaign2?.setThreat_actor)
                {
                    await
                    ThreatCampaign2.
                    setThreat_actor(relatedThreat_actor2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
    
        
            
            async function associateThreatCampaignWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ThreatCampaign0 = await ThreatCampaigns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (ThreatCampaign0?.setOrganization)
                {
                    await
                    ThreatCampaign0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ThreatCampaign1 = await ThreatCampaigns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (ThreatCampaign1?.setOrganization)
                {
                    await
                    ThreatCampaign1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const ThreatCampaign2 = await ThreatCampaigns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (ThreatCampaign2?.setOrganization)
                {
                    await
                    ThreatCampaign2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateAttackMapEventWithIndicator() {
            
                const relatedIndicator0 = await ThreatIndicators.findOne({
                    offset: Math.floor(Math.random() * (await ThreatIndicators.count())),
                });
                const AttackMapEvent0 = await AttackMapEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AttackMapEvent0?.setIndicator)
                {
                    await
                    AttackMapEvent0.
                    setIndicator(relatedIndicator0);
                }
            
                const relatedIndicator1 = await ThreatIndicators.findOne({
                    offset: Math.floor(Math.random() * (await ThreatIndicators.count())),
                });
                const AttackMapEvent1 = await AttackMapEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AttackMapEvent1?.setIndicator)
                {
                    await
                    AttackMapEvent1.
                    setIndicator(relatedIndicator1);
                }
            
                const relatedIndicator2 = await ThreatIndicators.findOne({
                    offset: Math.floor(Math.random() * (await ThreatIndicators.count())),
                });
                const AttackMapEvent2 = await AttackMapEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AttackMapEvent2?.setIndicator)
                {
                    await
                    AttackMapEvent2.
                    setIndicator(relatedIndicator2);
                }
            
        }
        
    
        
            
            async function associateAttackMapEventWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AttackMapEvent0 = await AttackMapEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AttackMapEvent0?.setOrganization)
                {
                    await
                    AttackMapEvent0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AttackMapEvent1 = await AttackMapEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AttackMapEvent1?.setOrganization)
                {
                    await
                    AttackMapEvent1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AttackMapEvent2 = await AttackMapEvents.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AttackMapEvent2?.setOrganization)
                {
                    await
                    AttackMapEvent2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateRiskAssessmentWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RiskAssessment0 = await RiskAssessments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RiskAssessment0?.setOrganization)
                {
                    await
                    RiskAssessment0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RiskAssessment1 = await RiskAssessments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RiskAssessment1?.setOrganization)
                {
                    await
                    RiskAssessment1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const RiskAssessment2 = await RiskAssessments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RiskAssessment2?.setOrganization)
                {
                    await
                    RiskAssessment2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
    
        
            
            async function associateRiskAssessmentWithAsset() {
            
                const relatedAsset0 = await Assets.findOne({
                    offset: Math.floor(Math.random() * (await Assets.count())),
                });
                const RiskAssessment0 = await RiskAssessments.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (RiskAssessment0?.setAsset)
                {
                    await
                    RiskAssessment0.
                    setAsset(relatedAsset0);
                }
            
                const relatedAsset1 = await Assets.findOne({
                    offset: Math.floor(Math.random() * (await Assets.count())),
                });
                const RiskAssessment1 = await RiskAssessments.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (RiskAssessment1?.setAsset)
                {
                    await
                    RiskAssessment1.
                    setAsset(relatedAsset1);
                }
            
                const relatedAsset2 = await Assets.findOne({
                    offset: Math.floor(Math.random() * (await Assets.count())),
                });
                const RiskAssessment2 = await RiskAssessments.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (RiskAssessment2?.setAsset)
                {
                    await
                    RiskAssessment2.
                    setAsset(relatedAsset2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    

    
    
    
        
    
        
    
        
    
        
            
            async function associateSimulationLabWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SimulationLab0 = await SimulationLabs.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SimulationLab0?.setOrganization)
                {
                    await
                    SimulationLab0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SimulationLab1 = await SimulationLabs.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SimulationLab1?.setOrganization)
                {
                    await
                    SimulationLab1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SimulationLab2 = await SimulationLabs.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SimulationLab2?.setOrganization)
                {
                    await
                    SimulationLab2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
    
        
    

    
    
    
        
            
            async function associateSimulationRunWithLab() {
            
                const relatedLab0 = await SimulationLabs.findOne({
                    offset: Math.floor(Math.random() * (await SimulationLabs.count())),
                });
                const SimulationRun0 = await SimulationRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SimulationRun0?.setLab)
                {
                    await
                    SimulationRun0.
                    setLab(relatedLab0);
                }
            
                const relatedLab1 = await SimulationLabs.findOne({
                    offset: Math.floor(Math.random() * (await SimulationLabs.count())),
                });
                const SimulationRun1 = await SimulationRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SimulationRun1?.setLab)
                {
                    await
                    SimulationRun1.
                    setLab(relatedLab1);
                }
            
                const relatedLab2 = await SimulationLabs.findOne({
                    offset: Math.floor(Math.random() * (await SimulationLabs.count())),
                });
                const SimulationRun2 = await SimulationRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SimulationRun2?.setLab)
                {
                    await
                    SimulationRun2.
                    setLab(relatedLab2);
                }
            
        }
        
    
        
            
            async function associateSimulationRunWithInitiated_by() {
            
                const relatedInitiated_by0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SimulationRun0 = await SimulationRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SimulationRun0?.setInitiated_by)
                {
                    await
                    SimulationRun0.
                    setInitiated_by(relatedInitiated_by0);
                }
            
                const relatedInitiated_by1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SimulationRun1 = await SimulationRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SimulationRun1?.setInitiated_by)
                {
                    await
                    SimulationRun1.
                    setInitiated_by(relatedInitiated_by1);
                }
            
                const relatedInitiated_by2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const SimulationRun2 = await SimulationRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SimulationRun2?.setInitiated_by)
                {
                    await
                    SimulationRun2.
                    setInitiated_by(relatedInitiated_by2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            // Similar logic for "relation_many"
        
    
        
            
            async function associateSimulationRunWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SimulationRun0 = await SimulationRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (SimulationRun0?.setOrganization)
                {
                    await
                    SimulationRun0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SimulationRun1 = await SimulationRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (SimulationRun1?.setOrganization)
                {
                    await
                    SimulationRun1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const SimulationRun2 = await SimulationRuns.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (SimulationRun2?.setOrganization)
                {
                    await
                    SimulationRun2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateInfrastructureClusterWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InfrastructureCluster0 = await InfrastructureClusters.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (InfrastructureCluster0?.setOrganization)
                {
                    await
                    InfrastructureCluster0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InfrastructureCluster1 = await InfrastructureClusters.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (InfrastructureCluster1?.setOrganization)
                {
                    await
                    InfrastructureCluster1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const InfrastructureCluster2 = await InfrastructureClusters.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (InfrastructureCluster2?.setOrganization)
                {
                    await
                    InfrastructureCluster2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateEdgeSensorWithCluster() {
            
                const relatedCluster0 = await InfrastructureClusters.findOne({
                    offset: Math.floor(Math.random() * (await InfrastructureClusters.count())),
                });
                const EdgeSensor0 = await EdgeSensors.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EdgeSensor0?.setCluster)
                {
                    await
                    EdgeSensor0.
                    setCluster(relatedCluster0);
                }
            
                const relatedCluster1 = await InfrastructureClusters.findOne({
                    offset: Math.floor(Math.random() * (await InfrastructureClusters.count())),
                });
                const EdgeSensor1 = await EdgeSensors.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EdgeSensor1?.setCluster)
                {
                    await
                    EdgeSensor1.
                    setCluster(relatedCluster1);
                }
            
                const relatedCluster2 = await InfrastructureClusters.findOne({
                    offset: Math.floor(Math.random() * (await InfrastructureClusters.count())),
                });
                const EdgeSensor2 = await EdgeSensors.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EdgeSensor2?.setCluster)
                {
                    await
                    EdgeSensor2.
                    setCluster(relatedCluster2);
                }
            
        }
        
    
        
            
            async function associateEdgeSensorWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EdgeSensor0 = await EdgeSensors.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (EdgeSensor0?.setOrganization)
                {
                    await
                    EdgeSensor0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EdgeSensor1 = await EdgeSensors.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (EdgeSensor1?.setOrganization)
                {
                    await
                    EdgeSensor1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const EdgeSensor2 = await EdgeSensors.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (EdgeSensor2?.setOrganization)
                {
                    await
                    EdgeSensor2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateReportWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Report0 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Report0?.setOrganization)
                {
                    await
                    Report0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Report1 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Report1?.setOrganization)
                {
                    await
                    Report1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const Report2 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Report2?.setOrganization)
                {
                    await
                    Report2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
    
        
            
            async function associateReportWithAuthor() {
            
                const relatedAuthor0 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Report0 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (Report0?.setAuthor)
                {
                    await
                    Report0.
                    setAuthor(relatedAuthor0);
                }
            
                const relatedAuthor1 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Report1 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (Report1?.setAuthor)
                {
                    await
                    Report1.
                    setAuthor(relatedAuthor1);
                }
            
                const relatedAuthor2 = await Users.findOne({
                    offset: Math.floor(Math.random() * (await Users.count())),
                });
                const Report2 = await Reports.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (Report2?.setAuthor)
                {
                    await
                    Report2.
                    setAuthor(relatedAuthor2);
                }
            
        }
        
    

    
    
    
        
            
            async function associateAiRecommendationWithOrganization() {
            
                const relatedOrganization0 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiRecommendation0 = await AiRecommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiRecommendation0?.setOrganization)
                {
                    await
                    AiRecommendation0.
                    setOrganization(relatedOrganization0);
                }
            
                const relatedOrganization1 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiRecommendation1 = await AiRecommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiRecommendation1?.setOrganization)
                {
                    await
                    AiRecommendation1.
                    setOrganization(relatedOrganization1);
                }
            
                const relatedOrganization2 = await Organizations.findOne({
                    offset: Math.floor(Math.random() * (await Organizations.count())),
                });
                const AiRecommendation2 = await AiRecommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiRecommendation2?.setOrganization)
                {
                    await
                    AiRecommendation2.
                    setOrganization(relatedOrganization2);
                }
            
        }
        
    
        
            
            async function associateAiRecommendationWithIncident() {
            
                const relatedIncident0 = await Incidents.findOne({
                    offset: Math.floor(Math.random() * (await Incidents.count())),
                });
                const AiRecommendation0 = await AiRecommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiRecommendation0?.setIncident)
                {
                    await
                    AiRecommendation0.
                    setIncident(relatedIncident0);
                }
            
                const relatedIncident1 = await Incidents.findOne({
                    offset: Math.floor(Math.random() * (await Incidents.count())),
                });
                const AiRecommendation1 = await AiRecommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiRecommendation1?.setIncident)
                {
                    await
                    AiRecommendation1.
                    setIncident(relatedIncident1);
                }
            
                const relatedIncident2 = await Incidents.findOne({
                    offset: Math.floor(Math.random() * (await Incidents.count())),
                });
                const AiRecommendation2 = await AiRecommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiRecommendation2?.setIncident)
                {
                    await
                    AiRecommendation2.
                    setIncident(relatedIncident2);
                }
            
        }
        
    
        
            
            async function associateAiRecommendationWithModel() {
            
                const relatedModel0 = await AiModels.findOne({
                    offset: Math.floor(Math.random() * (await AiModels.count())),
                });
                const AiRecommendation0 = await AiRecommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 0
                });
                if (AiRecommendation0?.setModel)
                {
                    await
                    AiRecommendation0.
                    setModel(relatedModel0);
                }
            
                const relatedModel1 = await AiModels.findOne({
                    offset: Math.floor(Math.random() * (await AiModels.count())),
                });
                const AiRecommendation1 = await AiRecommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 1
                });
                if (AiRecommendation1?.setModel)
                {
                    await
                    AiRecommendation1.
                    setModel(relatedModel1);
                }
            
                const relatedModel2 = await AiModels.findOne({
                    offset: Math.floor(Math.random() * (await AiModels.count())),
                });
                const AiRecommendation2 = await AiRecommendations.findOne({
                    order: [['id', 'ASC']],
                    offset: 2
                });
                if (AiRecommendation2?.setModel)
                {
                    await
                    AiRecommendation2.
                    setModel(relatedModel2);
                }
            
        }
        
    
        
    
        
    
        
    
        
    
        
    
        
    


module.exports = {
    up: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
                
                await Organizations.bulkCreate(OrganizationsData);
                
            
            
                
                await Assets.bulkCreate(AssetsData);
                
            
            
                
                await DataSources.bulkCreate(DataSourcesData);
                
            
            
                
                await IngestionPipelines.bulkCreate(IngestionPipelinesData);
                
            
            
                
                await TelemetryEvents.bulkCreate(TelemetryEventsData);
                
            
            
                
                await AiModels.bulkCreate(AiModelsData);
                
            
            
                
                await Detections.bulkCreate(DetectionsData);
                
            
            
                
                await Incidents.bulkCreate(IncidentsData);
                
            
            
                
                await ResponsePlaybooks.bulkCreate(ResponsePlaybooksData);
                
            
            
                
                await ResponseActions.bulkCreate(ResponseActionsData);
                
            
            
                
                await SocAgents.bulkCreate(SocAgentsData);
                
            
            
                
                await ThreatActors.bulkCreate(ThreatActorsData);
                
            
            
                
                await ThreatIndicators.bulkCreate(ThreatIndicatorsData);
                
            
            
                
                await ThreatCampaigns.bulkCreate(ThreatCampaignsData);
                
            
            
                
                await AttackMapEvents.bulkCreate(AttackMapEventsData);
                
            
            
                
                await RiskAssessments.bulkCreate(RiskAssessmentsData);
                
            
            
                
                await SimulationLabs.bulkCreate(SimulationLabsData);
                
            
            
                
                await SimulationRuns.bulkCreate(SimulationRunsData);
                
            
            
                
                await InfrastructureClusters.bulkCreate(InfrastructureClustersData);
                
            
            
                
                await EdgeSensors.bulkCreate(EdgeSensorsData);
                
            
            
                
                await Reports.bulkCreate(ReportsData);
                
            
            
                
                await AiRecommendations.bulkCreate(AiRecommendationsData);
                
            
            await Promise.all([
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateUserWithOrganization(),
                    
                
            
                
                
                
                
                    
                
            
                
                
                    
                        
                        await associateAssetWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateAssetWithSensor(),
                    
                
            
                
                
                    
                        
                        await associateDataSourceWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateIngestionPipelineWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateTelemetryEventWithOrganization(),
                    
                
                    
                        
                        await associateTelemetryEventWithData_source(),
                    
                
                    
                        
                        await associateTelemetryEventWithAsset(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateAiModelWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateDetectionWithOrganization(),
                    
                
                    
                        
                        await associateDetectionWithEvent(),
                    
                
                    
                        
                        await associateDetectionWithModel(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateIncidentWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateIncidentWithAssignee(),
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateResponsePlaybookWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateResponseActionWithIncident(),
                    
                
                    
                        
                        await associateResponseActionWithPlaybook(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateResponseActionWithRequested_by(),
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateResponseActionWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSocAgentWithModel(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSocAgentWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateThreatActorWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateThreatIndicatorWithThreat_actor(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateThreatIndicatorWithOrganization(),
                    
                
            
                
                
                    
                
                    
                        
                        await associateThreatCampaignWithThreat_actor(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                
                    
                        
                        await associateThreatCampaignWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateAttackMapEventWithIndicator(),
                    
                
                    
                        
                        await associateAttackMapEventWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateRiskAssessmentWithOrganization(),
                    
                
                    
                
                    
                
                    
                        
                        await associateRiskAssessmentWithAsset(),
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                        
                        await associateSimulationLabWithOrganization(),
                    
                
                    
                
                    
                
                    
                
            
                
                
                    
                        
                        await associateSimulationRunWithLab(),
                    
                
                    
                        
                        await associateSimulationRunWithInitiated_by(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        // Similar logic for "relation_many"
                    
                
                    
                        
                        await associateSimulationRunWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateInfrastructureClusterWithOrganization(),
                    
                
            
                
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateEdgeSensorWithCluster(),
                    
                
                    
                        
                        await associateEdgeSensorWithOrganization(),
                    
                
            
                
                
                    
                        
                        await associateReportWithOrganization(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                        
                        await associateReportWithAuthor(),
                    
                
            
                
                
                    
                        
                        await associateAiRecommendationWithOrganization(),
                    
                
                    
                        
                        await associateAiRecommendationWithIncident(),
                    
                
                    
                        
                        await associateAiRecommendationWithModel(),
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            ]);
        
    },

    down: async (queryInterface, Sequelize) => {
        
            
            
            
            
            
            await queryInterface.bulkDelete('organizations', null, {});
            
            
            await queryInterface.bulkDelete('assets', null, {});
            
            
            await queryInterface.bulkDelete('data_sources', null, {});
            
            
            await queryInterface.bulkDelete('ingestion_pipelines', null, {});
            
            
            await queryInterface.bulkDelete('telemetry_events', null, {});
            
            
            await queryInterface.bulkDelete('ai_models', null, {});
            
            
            await queryInterface.bulkDelete('detections', null, {});
            
            
            await queryInterface.bulkDelete('incidents', null, {});
            
            
            await queryInterface.bulkDelete('response_playbooks', null, {});
            
            
            await queryInterface.bulkDelete('response_actions', null, {});
            
            
            await queryInterface.bulkDelete('soc_agents', null, {});
            
            
            await queryInterface.bulkDelete('threat_actors', null, {});
            
            
            await queryInterface.bulkDelete('threat_indicators', null, {});
            
            
            await queryInterface.bulkDelete('threat_campaigns', null, {});
            
            
            await queryInterface.bulkDelete('attack_map_events', null, {});
            
            
            await queryInterface.bulkDelete('risk_assessments', null, {});
            
            
            await queryInterface.bulkDelete('simulation_labs', null, {});
            
            
            await queryInterface.bulkDelete('simulation_runs', null, {});
            
            
            await queryInterface.bulkDelete('infrastructure_clusters', null, {});
            
            
            await queryInterface.bulkDelete('edge_sensors', null, {});
            
            
            await queryInterface.bulkDelete('reports', null, {});
            
            
            await queryInterface.bulkDelete('ai_recommendations', null, {});
            
        
    },
};