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

const AccessRoles = db.access_roles;

const AiAgents = db.ai_agents;

const Alerts = db.alerts;

const AutomationJobs = db.automation_jobs;

const Campaigns = db.campaigns;

const ComplianceAudits = db.compliance_audits;

const ComplianceIssues = db.compliance_issues;

const ExpansionPlans = db.expansion_plans;

const InfrastructureStatuses = db.infrastructure_statuses;

const Invoices = db.invoices;

const MarketSignals = db.market_signals;

const OnboardingCases = db.onboarding_cases;

const PatientMessages = db.patient_messages;

const PatientProfiles = db.patient_profiles;

const PlatformMetrics = db.platform_metrics;

const PricingStrategies = db.pricing_strategies;

const RevenueSummaries = db.revenue_summaries;

const SubscriberActivities = db.subscriber_activities;

const SubscriberRoles = db.subscriber_roles;

const Subscribers = db.subscribers;

const SupportTickets = db.support_tickets;

const Organizations = db.organizations;

const AccessRolesData = [
  {
    name: 'Gustav Kirchhoff',

    user_count: 8,

    last_suspicious_login: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    name: 'Edwin Hubble',

    user_count: 3,

    last_suspicious_login: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    name: 'Emil Fischer',

    user_count: 7,

    last_suspicious_login: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    name: 'Max Born',

    user_count: 5,

    last_suspicious_login: new Date(Date.now()),

    // type code here for "relation_one" field
  },
];

const AiAgentsData = [
  {
    // type code here for "relation_one" field

    name: 'Neils Bohr',

    version: 'Ludwig Boltzmann',

    accuracy_pct: 43.93,

    latency_ms: 23.13,

    status: 'active',

    last_updated: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    name: 'Albrecht von Haller',

    version: 'Emil Kraepelin',

    accuracy_pct: 80.05,

    latency_ms: 73.83,

    status: 'active',

    last_updated: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    name: 'Edwin Hubble',

    version: 'John von Neumann',

    accuracy_pct: 48.93,

    latency_ms: 94.12,

    status: 'active',

    last_updated: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    name: 'Rudolf Virchow',

    version: 'Willard Libby',

    accuracy_pct: 34.71,

    latency_ms: 94.05,

    status: 'active',

    last_updated: new Date(Date.now()),

    // type code here for "relation_one" field
  },
];

const AlertsData = [
  {
    // type code here for "relation_one" field

    type: 'security',

    severity: 'high',

    message: 'Lucretius',

    status: 'resolved',

    resolved_at: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    type: 'billing',

    severity: 'high',

    message: 'Neils Bohr',

    status: 'resolved',

    resolved_at: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    type: 'billing',

    severity: 'high',

    message: 'Noam Chomsky',

    status: 'resolved',

    resolved_at: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    type: 'billing',

    severity: 'high',

    message: 'Gregor Mendel',

    status: 'resolved',

    resolved_at: new Date(Date.now()),

    // type code here for "relation_one" field
  },
];

const AutomationJobsData = [
  {
    // type code here for "relation_one" field

    workflow_name: 'Isaac Newton',

    status: 'pending',

    runtime_ms: 76.86,

    error_msg: 'Johannes Kepler',

    started_at: new Date(Date.now()),

    finished_at: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    workflow_name: 'Nicolaus Copernicus',

    status: 'failed',

    runtime_ms: 44.98,

    error_msg: 'Hermann von Helmholtz',

    started_at: new Date(Date.now()),

    finished_at: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    workflow_name: 'Anton van Leeuwenhoek',

    status: 'running',

    runtime_ms: 16.09,

    error_msg: 'Sigmund Freud',

    started_at: new Date(Date.now()),

    finished_at: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    workflow_name: 'Marie Curie',

    status: 'failed',

    runtime_ms: 81.89,

    error_msg: 'Sheldon Glashow',

    started_at: new Date(Date.now()),

    finished_at: new Date(Date.now()),

    // type code here for "relation_one" field
  },
];

const CampaignsData = [
  {
    // type code here for "relation_one" field

    name: 'Max Delbruck',

    spend: 25.05,

    impressions: 7,

    clicks: 7,

    conversions: 4,

    cpa: 32.95,

    ctr_pct: 23.12,

    status: 'paused',

    start_date: new Date(Date.now()),

    end_date: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    name: 'Ernest Rutherford',

    spend: 68.72,

    impressions: 3,

    clicks: 9,

    conversions: 4,

    cpa: 52.19,

    ctr_pct: 14.95,

    status: 'paused',

    start_date: new Date(Date.now()),

    end_date: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    name: 'Claude Bernard',

    spend: 91.69,

    impressions: 2,

    clicks: 9,

    conversions: 4,

    cpa: 27.36,

    ctr_pct: 26.83,

    status: 'active',

    start_date: new Date(Date.now()),

    end_date: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    name: 'Alfred Binet',

    spend: 67.77,

    impressions: 2,

    clicks: 1,

    conversions: 2,

    cpa: 19.99,

    ctr_pct: 81.05,

    status: 'paused',

    start_date: new Date(Date.now()),

    end_date: new Date(Date.now()),

    // type code here for "relation_one" field
  },
];

const ComplianceAuditsData = [
  {
    // type code here for "relation_one" field

    date: new Date(Date.now()),

    result: 'fail',

    issues_found: 5,

    // type code here for "relation_one" field

    report_url: 'Sigmund Freud',

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    date: new Date(Date.now()),

    result: 'pass',

    issues_found: 9,

    // type code here for "relation_one" field

    report_url: 'Nicolaus Copernicus',

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    date: new Date(Date.now()),

    result: 'pass',

    issues_found: 1,

    // type code here for "relation_one" field

    report_url: 'Ludwig Boltzmann',

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    date: new Date(Date.now()),

    result: 'fail',

    issues_found: 7,

    // type code here for "relation_one" field

    report_url: 'Charles Lyell',

    // type code here for "relation_one" field
  },
];

const ComplianceIssuesData = [
  {
    // type code here for "relation_one" field

    category: 'privacy',

    description: 'Hans Selye',

    severity: 'high',

    // type code here for "relation_one" field

    status: 'open',

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    category: 'privacy',

    description: 'Carl Gauss (Karl Friedrich Gauss)',

    severity: 'medium',

    // type code here for "relation_one" field

    status: 'open',

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    category: 'security',

    description: 'Paul Ehrlich',

    severity: 'high',

    // type code here for "relation_one" field

    status: 'open',

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    category: 'privacy',

    description: 'Marcello Malpighi',

    severity: 'medium',

    // type code here for "relation_one" field

    status: 'open',

    // type code here for "relation_one" field
  },
];

const ExpansionPlansData = [
  {
    // type code here for "relation_one" field

    territory: 'Justus Liebig',

    status: 'proposed',

    projected_roi_pct: 86.64,

    start_date: new Date(Date.now()),

    approval_status: 'approved',

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    territory: 'Hermann von Helmholtz',

    status: 'active',

    projected_roi_pct: 69.76,

    start_date: new Date(Date.now()),

    approval_status: 'rejected',

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    territory: 'Edward Teller',

    status: 'completed',

    projected_roi_pct: 29.24,

    start_date: new Date(Date.now()),

    approval_status: 'pending',

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    territory: 'Alfred Wegener',

    status: 'completed',

    projected_roi_pct: 63.27,

    start_date: new Date(Date.now()),

    approval_status: 'pending',

    // type code here for "relation_one" field
  },
];

const InfrastructureStatusesData = [
  {
    // type code here for "relation_one" field

    service: 'Alfred Kinsey',

    uptime_pct: 15.19,

    latency_ms: 79.58,

    error_rate: 66.17,

    status: 'down',

    last_updated: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    service: 'Jean Baptiste Lamarck',

    uptime_pct: 19.37,

    latency_ms: 88.29,

    error_rate: 92.31,

    status: 'down',

    last_updated: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    service: 'Noam Chomsky',

    uptime_pct: 28.16,

    latency_ms: 71.39,

    error_rate: 88.39,

    status: 'operational',

    last_updated: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    service: 'Ernst Haeckel',

    uptime_pct: 11.96,

    latency_ms: 13.86,

    error_rate: 46.45,

    status: 'operational',

    last_updated: new Date(Date.now()),

    // type code here for "relation_one" field
  },
];

const InvoicesData = [
  {
    // type code here for "relation_one" field

    // type code here for "relation_one" field

    payer: 'Self-pay',

    amount: 1500,

    status: 'disputed',

    due_date: new Date('2023-11-15T00:00:00Z'),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    // type code here for "relation_one" field

    payer: 'Private',

    amount: 2500,

    status: 'paid',

    due_date: new Date('2023-12-01T00:00:00Z'),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    // type code here for "relation_one" field

    payer: 'Medicaid',

    amount: 3200,

    status: 'paid',

    due_date: new Date('2023-10-20T00:00:00Z'),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    // type code here for "relation_one" field

    payer: 'Medicare',

    amount: 450,

    status: 'paid',

    due_date: new Date('2023-11-05T00:00:00Z'),

    // type code here for "relation_one" field
  },
];

const MarketSignalsData = [
  {
    // type code here for "relation_one" field

    competitor: 'Euclid',

    type: 'territory_entry',

    description: 'Carl Linnaeus',

    date_detected: new Date(Date.now()),

    impact_score: 33.38,

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    competitor: 'Carl Gauss (Karl Friedrich Gauss)',

    type: 'territory_entry',

    description: 'Leonard Euler',

    date_detected: new Date(Date.now()),

    impact_score: 83.78,

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    competitor: 'Emil Fischer',

    type: 'launch',

    description: 'Leonard Euler',

    date_detected: new Date(Date.now()),

    impact_score: 75.43,

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    competitor: 'Hans Selye',

    type: 'launch',

    description: 'John Dalton',

    date_detected: new Date(Date.now()),

    impact_score: 54.42,

    // type code here for "relation_one" field
  },
];

const OnboardingCasesData = [
  {
    // type code here for "relation_one" field

    // type code here for "relation_one" field

    role: 'finance_admin',

    status: 'pending',

    start_date: new Date(Date.now()),

    completion_date: new Date(Date.now()),

    // type code here for "relation_one" field

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    // type code here for "relation_one" field

    role: 'finance_admin',

    status: 'completed',

    start_date: new Date(Date.now()),

    completion_date: new Date(Date.now()),

    // type code here for "relation_one" field

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    // type code here for "relation_one" field

    role: 'provider',

    status: 'active',

    start_date: new Date(Date.now()),

    completion_date: new Date(Date.now()),

    // type code here for "relation_one" field

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    // type code here for "relation_one" field

    role: 'provider',

    status: 'completed',

    start_date: new Date(Date.now()),

    completion_date: new Date(Date.now()),

    // type code here for "relation_one" field

    // type code here for "relation_one" field
  },
];

const PatientMessagesData = [
  {
    sender: 'Euclid',

    message: 'Frederick Gowland Hopkins',

    read_status: 'read',

    // type code here for "relation_one" field
  },

  {
    sender: 'Francis Crick',

    message: 'James Watson',

    read_status: 'unread',

    // type code here for "relation_one" field
  },

  {
    sender: 'Francis Galton',

    message: 'Michael Faraday',

    read_status: 'read',

    // type code here for "relation_one" field
  },

  {
    sender: 'Isaac Newton',

    message: 'Gertrude Belle Elion',

    read_status: 'unread',

    // type code here for "relation_one" field
  },
];

const PatientProfilesData = [
  {
    // type code here for "relation_one" field

    health_metrics: 'Claude Levi-Strauss',

    prescriptions: 'Lynn Margulis',

    appointments: 'Pierre Simon de Laplace',

    billing: 'Jean Piaget',

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    health_metrics: 'Stephen Hawking',

    prescriptions: 'Thomas Hunt Morgan',

    appointments: 'Enrico Fermi',

    billing: 'Antoine Laurent Lavoisier',

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    health_metrics: 'Dmitri Mendeleev',

    prescriptions: 'Ludwig Boltzmann',

    appointments: 'James Clerk Maxwell',

    billing: 'Jean Baptiste Lamarck',

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    health_metrics: 'James Watson',

    prescriptions: 'Max Born',

    appointments: 'William Bayliss',

    billing: 'Isaac Newton',

    // type code here for "relation_one" field
  },
];

const PlatformMetricsData = [
  {
    // type code here for "relation_one" field

    region: 'Ernest Rutherford',

    api_latency_ms: 93.29,

    uptime_pct: 97.24,

    page_load_ms: 10.15,

    timestamp: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    region: 'Jean Baptiste Lamarck',

    api_latency_ms: 49.05,

    uptime_pct: 90.66,

    page_load_ms: 98.64,

    timestamp: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    region: 'Karl Landsteiner',

    api_latency_ms: 18.77,

    uptime_pct: 99.66,

    page_load_ms: 14.05,

    timestamp: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    region: 'Wilhelm Wundt',

    api_latency_ms: 38.04,

    uptime_pct: 52.58,

    page_load_ms: 14.14,

    timestamp: new Date(Date.now()),

    // type code here for "relation_one" field
  },
];

const PricingStrategiesData = [
  {
    // type code here for "relation_one" field

    name: 'Fall Discount',

    product: 'General Checkup',

    price: 100,

    status: 'inactive',

    start_date: new Date('2023-10-01T00:00:00Z'),

    end_date: new Date('2023-12-31T00:00:00Z'),

    metrics: '{conversion_rate: 0.15, average_order_value: 120.00}',

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    name: 'Winter Special',

    product: 'Dental Cleaning',

    price: 80,

    status: 'inactive',

    start_date: new Date('2023-11-01T00:00:00Z'),

    end_date: new Date('2024-01-31T00:00:00Z'),

    metrics: '{conversion_rate: 0.20, average_order_value: 90.00}',

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    name: 'Spring Promotion',

    product: 'Eye Exam',

    price: 50,

    status: 'active',

    start_date: new Date('2023-03-01T00:00:00Z'),

    end_date: new Date('2023-05-31T00:00:00Z'),

    metrics: '{conversion_rate: 0.10, average_order_value: 55.00}',

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    name: 'Summer Sale',

    product: 'Physical Therapy',

    price: 150,

    status: 'active',

    start_date: new Date('2023-06-01T00:00:00Z'),

    end_date: new Date('2023-08-31T00:00:00Z'),

    metrics: '{conversion_rate: 0.12, average_order_value: 160.00}',

    // type code here for "relation_one" field
  },
];

const RevenueSummariesData = [
  {
    // type code here for "relation_one" field

    month: '2023-09',

    total_amount: 50000,

    payer_breakdown:
      '{Medicare: 20000, Medicaid: 15000, Private: 10000, Self-pay: 5000}',

    growth_pct: 5,

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    month: '2023-09',

    total_amount: 75000,

    payer_breakdown:
      '{Medicare: 30000, Medicaid: 20000, Private: 15000, Self-pay: 10000}',

    growth_pct: 7.5,

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    month: '2023-09',

    total_amount: 60000,

    payer_breakdown:
      '{Medicare: 25000, Medicaid: 15000, Private: 15000, Self-pay: 5000}',

    growth_pct: 6,

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    month: '2023-09',

    total_amount: 80000,

    payer_breakdown:
      '{Medicare: 35000, Medicaid: 20000, Private: 15000, Self-pay: 10000}',

    growth_pct: 8,

    // type code here for "relation_one" field
  },
];

const SubscriberActivitiesData = [
  {
    // type code here for "relation_one" field

    action: 'August Kekule',

    object: 'Louis Pasteur',

    timestamp: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    action: 'Louis Pasteur',

    object: 'George Gaylord Simpson',

    timestamp: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    action: 'Stephen Hawking',

    object: 'William Herschel',

    timestamp: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    action: 'Claude Bernard',

    object: 'Comte de Buffon',

    timestamp: new Date(Date.now()),

    // type code here for "relation_one" field
  },
];

const SubscriberRolesData = [
  {
    // type code here for "relation_one" field

    role_name: 'Trofim Lysenko',

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    role_name: 'Charles Darwin',

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    role_name: 'Claude Levi-Strauss',

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    role_name: 'Michael Faraday',

    // type code here for "relation_one" field
  },
];

const SubscribersData = [
  {
    // type code here for "relation_one" field

    name: 'James Clerk Maxwell',

    org: 'Albert Einstein',

    email: 'Johannes Kepler',

    role: 'user',

    status: 'pending',

    last_login: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    name: 'Frederick Sanger',

    org: 'Wilhelm Wundt',

    email: 'Max Delbruck',

    role: 'admin',

    status: 'active',

    last_login: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    name: 'Nicolaus Copernicus',

    org: 'Michael Faraday',

    email: 'Tycho Brahe',

    role: 'admin',

    status: 'pending',

    last_login: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    name: 'Albert Einstein',

    org: 'Albert Einstein',

    email: 'Franz Boas',

    role: 'user',

    status: 'pending',

    last_login: new Date(Date.now()),

    // type code here for "relation_one" field
  },
];

const SupportTicketsData = [
  {
    // type code here for "relation_one" field

    subject: 'Edward O. Wilson',

    category: 'general',

    priority: 'high',

    status: 'escalated',

    // type code here for "relation_one" field

    resolved_at: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    subject: 'Lucretius',

    category: 'technical',

    priority: 'urgent',

    status: 'resolved',

    // type code here for "relation_one" field

    resolved_at: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    subject: 'Werner Heisenberg',

    category: 'billing',

    priority: 'urgent',

    status: 'open',

    // type code here for "relation_one" field

    resolved_at: new Date(Date.now()),

    // type code here for "relation_one" field
  },

  {
    // type code here for "relation_one" field

    subject: 'Charles Lyell',

    category: 'technical',

    priority: 'urgent',

    status: 'in_progress',

    // type code here for "relation_one" field

    resolved_at: new Date(Date.now()),

    // type code here for "relation_one" field
  },
];

const OrganizationsData = [
  {
    name: 'NorthBay Health',
  },

  {
    name: 'Evergreen Clinic Group',
  },

  {
    name: 'MetroCare Hospitals',
  },

  {
    name: 'Sunrise Diagnostics',
  },
];

// Similar logic for "relation_many"

async function associateUserWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const User0 = await Users.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (User0?.setOrganization) {
    await User0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const User1 = await Users.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (User1?.setOrganization) {
    await User1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const User2 = await Users.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (User2?.setOrganization) {
    await User2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const User3 = await Users.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (User3?.setOrganization) {
    await User3.setOrganization(relatedOrganization3);
  }
}

async function associateAccessRoleWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AccessRole0 = await AccessRoles.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (AccessRole0?.setOrganization) {
    await AccessRole0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AccessRole1 = await AccessRoles.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (AccessRole1?.setOrganization) {
    await AccessRole1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AccessRole2 = await AccessRoles.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (AccessRole2?.setOrganization) {
    await AccessRole2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AccessRole3 = await AccessRoles.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (AccessRole3?.setOrganization) {
    await AccessRole3.setOrganization(relatedOrganization3);
  }
}

async function associateAiAgentWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AiAgent0 = await AiAgents.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (AiAgent0?.setOrganization) {
    await AiAgent0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AiAgent1 = await AiAgents.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (AiAgent1?.setOrganization) {
    await AiAgent1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AiAgent2 = await AiAgents.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (AiAgent2?.setOrganization) {
    await AiAgent2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AiAgent3 = await AiAgents.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (AiAgent3?.setOrganization) {
    await AiAgent3.setOrganization(relatedOrganization3);
  }
}

async function associateAiAgentWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AiAgent0 = await AiAgents.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (AiAgent0?.setOrganization) {
    await AiAgent0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AiAgent1 = await AiAgents.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (AiAgent1?.setOrganization) {
    await AiAgent1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AiAgent2 = await AiAgents.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (AiAgent2?.setOrganization) {
    await AiAgent2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AiAgent3 = await AiAgents.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (AiAgent3?.setOrganization) {
    await AiAgent3.setOrganization(relatedOrganization3);
  }
}

async function associateAlertWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Alert0 = await Alerts.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (Alert0?.setOrganization) {
    await Alert0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Alert1 = await Alerts.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (Alert1?.setOrganization) {
    await Alert1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Alert2 = await Alerts.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (Alert2?.setOrganization) {
    await Alert2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Alert3 = await Alerts.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (Alert3?.setOrganization) {
    await Alert3.setOrganization(relatedOrganization3);
  }
}

async function associateAlertWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Alert0 = await Alerts.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (Alert0?.setOrganization) {
    await Alert0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Alert1 = await Alerts.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (Alert1?.setOrganization) {
    await Alert1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Alert2 = await Alerts.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (Alert2?.setOrganization) {
    await Alert2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Alert3 = await Alerts.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (Alert3?.setOrganization) {
    await Alert3.setOrganization(relatedOrganization3);
  }
}

async function associateAutomationJobWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AutomationJob0 = await AutomationJobs.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (AutomationJob0?.setOrganization) {
    await AutomationJob0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AutomationJob1 = await AutomationJobs.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (AutomationJob1?.setOrganization) {
    await AutomationJob1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AutomationJob2 = await AutomationJobs.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (AutomationJob2?.setOrganization) {
    await AutomationJob2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AutomationJob3 = await AutomationJobs.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (AutomationJob3?.setOrganization) {
    await AutomationJob3.setOrganization(relatedOrganization3);
  }
}

async function associateAutomationJobWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AutomationJob0 = await AutomationJobs.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (AutomationJob0?.setOrganization) {
    await AutomationJob0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AutomationJob1 = await AutomationJobs.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (AutomationJob1?.setOrganization) {
    await AutomationJob1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AutomationJob2 = await AutomationJobs.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (AutomationJob2?.setOrganization) {
    await AutomationJob2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const AutomationJob3 = await AutomationJobs.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (AutomationJob3?.setOrganization) {
    await AutomationJob3.setOrganization(relatedOrganization3);
  }
}

async function associateCampaignWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Campaign0 = await Campaigns.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (Campaign0?.setOrganization) {
    await Campaign0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Campaign1 = await Campaigns.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (Campaign1?.setOrganization) {
    await Campaign1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Campaign2 = await Campaigns.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (Campaign2?.setOrganization) {
    await Campaign2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Campaign3 = await Campaigns.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (Campaign3?.setOrganization) {
    await Campaign3.setOrganization(relatedOrganization3);
  }
}

async function associateCampaignWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Campaign0 = await Campaigns.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (Campaign0?.setOrganization) {
    await Campaign0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Campaign1 = await Campaigns.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (Campaign1?.setOrganization) {
    await Campaign1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Campaign2 = await Campaigns.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (Campaign2?.setOrganization) {
    await Campaign2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Campaign3 = await Campaigns.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (Campaign3?.setOrganization) {
    await Campaign3.setOrganization(relatedOrganization3);
  }
}

async function associateComplianceAuditWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ComplianceAudit0 = await ComplianceAudits.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (ComplianceAudit0?.setOrganization) {
    await ComplianceAudit0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ComplianceAudit1 = await ComplianceAudits.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (ComplianceAudit1?.setOrganization) {
    await ComplianceAudit1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ComplianceAudit2 = await ComplianceAudits.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (ComplianceAudit2?.setOrganization) {
    await ComplianceAudit2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ComplianceAudit3 = await ComplianceAudits.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (ComplianceAudit3?.setOrganization) {
    await ComplianceAudit3.setOrganization(relatedOrganization3);
  }
}

async function associateComplianceAuditWithOwner() {
  const relatedOwner0 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const ComplianceAudit0 = await ComplianceAudits.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (ComplianceAudit0?.setOwner) {
    await ComplianceAudit0.setOwner(relatedOwner0);
  }

  const relatedOwner1 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const ComplianceAudit1 = await ComplianceAudits.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (ComplianceAudit1?.setOwner) {
    await ComplianceAudit1.setOwner(relatedOwner1);
  }

  const relatedOwner2 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const ComplianceAudit2 = await ComplianceAudits.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (ComplianceAudit2?.setOwner) {
    await ComplianceAudit2.setOwner(relatedOwner2);
  }

  const relatedOwner3 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const ComplianceAudit3 = await ComplianceAudits.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (ComplianceAudit3?.setOwner) {
    await ComplianceAudit3.setOwner(relatedOwner3);
  }
}

async function associateComplianceAuditWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ComplianceAudit0 = await ComplianceAudits.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (ComplianceAudit0?.setOrganization) {
    await ComplianceAudit0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ComplianceAudit1 = await ComplianceAudits.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (ComplianceAudit1?.setOrganization) {
    await ComplianceAudit1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ComplianceAudit2 = await ComplianceAudits.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (ComplianceAudit2?.setOrganization) {
    await ComplianceAudit2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ComplianceAudit3 = await ComplianceAudits.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (ComplianceAudit3?.setOrganization) {
    await ComplianceAudit3.setOrganization(relatedOrganization3);
  }
}

async function associateComplianceIssueWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ComplianceIssue0 = await ComplianceIssues.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (ComplianceIssue0?.setOrganization) {
    await ComplianceIssue0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ComplianceIssue1 = await ComplianceIssues.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (ComplianceIssue1?.setOrganization) {
    await ComplianceIssue1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ComplianceIssue2 = await ComplianceIssues.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (ComplianceIssue2?.setOrganization) {
    await ComplianceIssue2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ComplianceIssue3 = await ComplianceIssues.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (ComplianceIssue3?.setOrganization) {
    await ComplianceIssue3.setOrganization(relatedOrganization3);
  }
}

async function associateComplianceIssueWithOwner() {
  const relatedOwner0 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const ComplianceIssue0 = await ComplianceIssues.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (ComplianceIssue0?.setOwner) {
    await ComplianceIssue0.setOwner(relatedOwner0);
  }

  const relatedOwner1 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const ComplianceIssue1 = await ComplianceIssues.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (ComplianceIssue1?.setOwner) {
    await ComplianceIssue1.setOwner(relatedOwner1);
  }

  const relatedOwner2 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const ComplianceIssue2 = await ComplianceIssues.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (ComplianceIssue2?.setOwner) {
    await ComplianceIssue2.setOwner(relatedOwner2);
  }

  const relatedOwner3 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const ComplianceIssue3 = await ComplianceIssues.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (ComplianceIssue3?.setOwner) {
    await ComplianceIssue3.setOwner(relatedOwner3);
  }
}

async function associateComplianceIssueWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ComplianceIssue0 = await ComplianceIssues.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (ComplianceIssue0?.setOrganization) {
    await ComplianceIssue0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ComplianceIssue1 = await ComplianceIssues.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (ComplianceIssue1?.setOrganization) {
    await ComplianceIssue1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ComplianceIssue2 = await ComplianceIssues.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (ComplianceIssue2?.setOrganization) {
    await ComplianceIssue2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ComplianceIssue3 = await ComplianceIssues.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (ComplianceIssue3?.setOrganization) {
    await ComplianceIssue3.setOrganization(relatedOrganization3);
  }
}

async function associateExpansionPlanWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ExpansionPlan0 = await ExpansionPlans.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (ExpansionPlan0?.setOrganization) {
    await ExpansionPlan0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ExpansionPlan1 = await ExpansionPlans.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (ExpansionPlan1?.setOrganization) {
    await ExpansionPlan1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ExpansionPlan2 = await ExpansionPlans.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (ExpansionPlan2?.setOrganization) {
    await ExpansionPlan2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ExpansionPlan3 = await ExpansionPlans.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (ExpansionPlan3?.setOrganization) {
    await ExpansionPlan3.setOrganization(relatedOrganization3);
  }
}

async function associateExpansionPlanWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ExpansionPlan0 = await ExpansionPlans.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (ExpansionPlan0?.setOrganization) {
    await ExpansionPlan0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ExpansionPlan1 = await ExpansionPlans.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (ExpansionPlan1?.setOrganization) {
    await ExpansionPlan1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ExpansionPlan2 = await ExpansionPlans.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (ExpansionPlan2?.setOrganization) {
    await ExpansionPlan2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const ExpansionPlan3 = await ExpansionPlans.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (ExpansionPlan3?.setOrganization) {
    await ExpansionPlan3.setOrganization(relatedOrganization3);
  }
}

async function associateInfrastructureStatusWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const InfrastructureStatus0 = await InfrastructureStatuses.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (InfrastructureStatus0?.setOrganization) {
    await InfrastructureStatus0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const InfrastructureStatus1 = await InfrastructureStatuses.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (InfrastructureStatus1?.setOrganization) {
    await InfrastructureStatus1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const InfrastructureStatus2 = await InfrastructureStatuses.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (InfrastructureStatus2?.setOrganization) {
    await InfrastructureStatus2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const InfrastructureStatus3 = await InfrastructureStatuses.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (InfrastructureStatus3?.setOrganization) {
    await InfrastructureStatus3.setOrganization(relatedOrganization3);
  }
}

async function associateInfrastructureStatusWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const InfrastructureStatus0 = await InfrastructureStatuses.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (InfrastructureStatus0?.setOrganization) {
    await InfrastructureStatus0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const InfrastructureStatus1 = await InfrastructureStatuses.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (InfrastructureStatus1?.setOrganization) {
    await InfrastructureStatus1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const InfrastructureStatus2 = await InfrastructureStatuses.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (InfrastructureStatus2?.setOrganization) {
    await InfrastructureStatus2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const InfrastructureStatus3 = await InfrastructureStatuses.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (InfrastructureStatus3?.setOrganization) {
    await InfrastructureStatus3.setOrganization(relatedOrganization3);
  }
}

async function associateInvoiceWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Invoice0 = await Invoices.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (Invoice0?.setOrganization) {
    await Invoice0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Invoice1 = await Invoices.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (Invoice1?.setOrganization) {
    await Invoice1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Invoice2 = await Invoices.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (Invoice2?.setOrganization) {
    await Invoice2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Invoice3 = await Invoices.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (Invoice3?.setOrganization) {
    await Invoice3.setOrganization(relatedOrganization3);
  }
}

async function associateInvoiceWithDoctor() {
  const relatedDoctor0 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const Invoice0 = await Invoices.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (Invoice0?.setDoctor) {
    await Invoice0.setDoctor(relatedDoctor0);
  }

  const relatedDoctor1 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const Invoice1 = await Invoices.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (Invoice1?.setDoctor) {
    await Invoice1.setDoctor(relatedDoctor1);
  }

  const relatedDoctor2 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const Invoice2 = await Invoices.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (Invoice2?.setDoctor) {
    await Invoice2.setDoctor(relatedDoctor2);
  }

  const relatedDoctor3 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const Invoice3 = await Invoices.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (Invoice3?.setDoctor) {
    await Invoice3.setDoctor(relatedDoctor3);
  }
}

async function associateInvoiceWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Invoice0 = await Invoices.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (Invoice0?.setOrganization) {
    await Invoice0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Invoice1 = await Invoices.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (Invoice1?.setOrganization) {
    await Invoice1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Invoice2 = await Invoices.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (Invoice2?.setOrganization) {
    await Invoice2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Invoice3 = await Invoices.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (Invoice3?.setOrganization) {
    await Invoice3.setOrganization(relatedOrganization3);
  }
}

async function associateMarketSignalWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const MarketSignal0 = await MarketSignals.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (MarketSignal0?.setOrganization) {
    await MarketSignal0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const MarketSignal1 = await MarketSignals.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (MarketSignal1?.setOrganization) {
    await MarketSignal1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const MarketSignal2 = await MarketSignals.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (MarketSignal2?.setOrganization) {
    await MarketSignal2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const MarketSignal3 = await MarketSignals.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (MarketSignal3?.setOrganization) {
    await MarketSignal3.setOrganization(relatedOrganization3);
  }
}

async function associateMarketSignalWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const MarketSignal0 = await MarketSignals.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (MarketSignal0?.setOrganization) {
    await MarketSignal0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const MarketSignal1 = await MarketSignals.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (MarketSignal1?.setOrganization) {
    await MarketSignal1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const MarketSignal2 = await MarketSignals.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (MarketSignal2?.setOrganization) {
    await MarketSignal2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const MarketSignal3 = await MarketSignals.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (MarketSignal3?.setOrganization) {
    await MarketSignal3.setOrganization(relatedOrganization3);
  }
}

async function associateOnboardingCaseWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const OnboardingCase0 = await OnboardingCases.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (OnboardingCase0?.setOrganization) {
    await OnboardingCase0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const OnboardingCase1 = await OnboardingCases.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (OnboardingCase1?.setOrganization) {
    await OnboardingCase1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const OnboardingCase2 = await OnboardingCases.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (OnboardingCase2?.setOrganization) {
    await OnboardingCase2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const OnboardingCase3 = await OnboardingCases.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (OnboardingCase3?.setOrganization) {
    await OnboardingCase3.setOrganization(relatedOrganization3);
  }
}

async function associateOnboardingCaseWithUser() {
  const relatedUser0 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const OnboardingCase0 = await OnboardingCases.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (OnboardingCase0?.setUser) {
    await OnboardingCase0.setUser(relatedUser0);
  }

  const relatedUser1 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const OnboardingCase1 = await OnboardingCases.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (OnboardingCase1?.setUser) {
    await OnboardingCase1.setUser(relatedUser1);
  }

  const relatedUser2 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const OnboardingCase2 = await OnboardingCases.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (OnboardingCase2?.setUser) {
    await OnboardingCase2.setUser(relatedUser2);
  }

  const relatedUser3 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const OnboardingCase3 = await OnboardingCases.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (OnboardingCase3?.setUser) {
    await OnboardingCase3.setUser(relatedUser3);
  }
}

async function associateOnboardingCaseWithAssigned_staff() {
  const relatedAssigned_staff0 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const OnboardingCase0 = await OnboardingCases.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (OnboardingCase0?.setAssigned_staff) {
    await OnboardingCase0.setAssigned_staff(relatedAssigned_staff0);
  }

  const relatedAssigned_staff1 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const OnboardingCase1 = await OnboardingCases.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (OnboardingCase1?.setAssigned_staff) {
    await OnboardingCase1.setAssigned_staff(relatedAssigned_staff1);
  }

  const relatedAssigned_staff2 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const OnboardingCase2 = await OnboardingCases.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (OnboardingCase2?.setAssigned_staff) {
    await OnboardingCase2.setAssigned_staff(relatedAssigned_staff2);
  }

  const relatedAssigned_staff3 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const OnboardingCase3 = await OnboardingCases.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (OnboardingCase3?.setAssigned_staff) {
    await OnboardingCase3.setAssigned_staff(relatedAssigned_staff3);
  }
}

async function associateOnboardingCaseWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const OnboardingCase0 = await OnboardingCases.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (OnboardingCase0?.setOrganization) {
    await OnboardingCase0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const OnboardingCase1 = await OnboardingCases.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (OnboardingCase1?.setOrganization) {
    await OnboardingCase1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const OnboardingCase2 = await OnboardingCases.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (OnboardingCase2?.setOrganization) {
    await OnboardingCase2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const OnboardingCase3 = await OnboardingCases.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (OnboardingCase3?.setOrganization) {
    await OnboardingCase3.setOrganization(relatedOrganization3);
  }
}

async function associatePatientMessageWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PatientMessage0 = await PatientMessages.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (PatientMessage0?.setOrganization) {
    await PatientMessage0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PatientMessage1 = await PatientMessages.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (PatientMessage1?.setOrganization) {
    await PatientMessage1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PatientMessage2 = await PatientMessages.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (PatientMessage2?.setOrganization) {
    await PatientMessage2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PatientMessage3 = await PatientMessages.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (PatientMessage3?.setOrganization) {
    await PatientMessage3.setOrganization(relatedOrganization3);
  }
}

async function associatePatientProfileWithSubscriber() {
  const relatedSubscriber0 = await Subscribers.findOne({
    offset: Math.floor(Math.random() * (await Subscribers.count())),
  });
  const PatientProfile0 = await PatientProfiles.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (PatientProfile0?.setSubscriber) {
    await PatientProfile0.setSubscriber(relatedSubscriber0);
  }

  const relatedSubscriber1 = await Subscribers.findOne({
    offset: Math.floor(Math.random() * (await Subscribers.count())),
  });
  const PatientProfile1 = await PatientProfiles.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (PatientProfile1?.setSubscriber) {
    await PatientProfile1.setSubscriber(relatedSubscriber1);
  }

  const relatedSubscriber2 = await Subscribers.findOne({
    offset: Math.floor(Math.random() * (await Subscribers.count())),
  });
  const PatientProfile2 = await PatientProfiles.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (PatientProfile2?.setSubscriber) {
    await PatientProfile2.setSubscriber(relatedSubscriber2);
  }

  const relatedSubscriber3 = await Subscribers.findOne({
    offset: Math.floor(Math.random() * (await Subscribers.count())),
  });
  const PatientProfile3 = await PatientProfiles.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (PatientProfile3?.setSubscriber) {
    await PatientProfile3.setSubscriber(relatedSubscriber3);
  }
}

async function associatePatientProfileWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PatientProfile0 = await PatientProfiles.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (PatientProfile0?.setOrganization) {
    await PatientProfile0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PatientProfile1 = await PatientProfiles.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (PatientProfile1?.setOrganization) {
    await PatientProfile1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PatientProfile2 = await PatientProfiles.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (PatientProfile2?.setOrganization) {
    await PatientProfile2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PatientProfile3 = await PatientProfiles.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (PatientProfile3?.setOrganization) {
    await PatientProfile3.setOrganization(relatedOrganization3);
  }
}

async function associatePlatformMetricWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PlatformMetric0 = await PlatformMetrics.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (PlatformMetric0?.setOrganization) {
    await PlatformMetric0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PlatformMetric1 = await PlatformMetrics.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (PlatformMetric1?.setOrganization) {
    await PlatformMetric1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PlatformMetric2 = await PlatformMetrics.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (PlatformMetric2?.setOrganization) {
    await PlatformMetric2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PlatformMetric3 = await PlatformMetrics.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (PlatformMetric3?.setOrganization) {
    await PlatformMetric3.setOrganization(relatedOrganization3);
  }
}

async function associatePlatformMetricWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PlatformMetric0 = await PlatformMetrics.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (PlatformMetric0?.setOrganization) {
    await PlatformMetric0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PlatformMetric1 = await PlatformMetrics.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (PlatformMetric1?.setOrganization) {
    await PlatformMetric1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PlatformMetric2 = await PlatformMetrics.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (PlatformMetric2?.setOrganization) {
    await PlatformMetric2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PlatformMetric3 = await PlatformMetrics.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (PlatformMetric3?.setOrganization) {
    await PlatformMetric3.setOrganization(relatedOrganization3);
  }
}

async function associatePricingStrategyWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PricingStrategy0 = await PricingStrategies.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (PricingStrategy0?.setOrganization) {
    await PricingStrategy0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PricingStrategy1 = await PricingStrategies.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (PricingStrategy1?.setOrganization) {
    await PricingStrategy1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PricingStrategy2 = await PricingStrategies.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (PricingStrategy2?.setOrganization) {
    await PricingStrategy2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PricingStrategy3 = await PricingStrategies.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (PricingStrategy3?.setOrganization) {
    await PricingStrategy3.setOrganization(relatedOrganization3);
  }
}

async function associatePricingStrategyWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PricingStrategy0 = await PricingStrategies.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (PricingStrategy0?.setOrganization) {
    await PricingStrategy0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PricingStrategy1 = await PricingStrategies.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (PricingStrategy1?.setOrganization) {
    await PricingStrategy1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PricingStrategy2 = await PricingStrategies.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (PricingStrategy2?.setOrganization) {
    await PricingStrategy2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const PricingStrategy3 = await PricingStrategies.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (PricingStrategy3?.setOrganization) {
    await PricingStrategy3.setOrganization(relatedOrganization3);
  }
}

async function associateRevenueSummaryWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const RevenueSummary0 = await RevenueSummaries.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (RevenueSummary0?.setOrganization) {
    await RevenueSummary0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const RevenueSummary1 = await RevenueSummaries.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (RevenueSummary1?.setOrganization) {
    await RevenueSummary1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const RevenueSummary2 = await RevenueSummaries.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (RevenueSummary2?.setOrganization) {
    await RevenueSummary2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const RevenueSummary3 = await RevenueSummaries.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (RevenueSummary3?.setOrganization) {
    await RevenueSummary3.setOrganization(relatedOrganization3);
  }
}

async function associateRevenueSummaryWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const RevenueSummary0 = await RevenueSummaries.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (RevenueSummary0?.setOrganization) {
    await RevenueSummary0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const RevenueSummary1 = await RevenueSummaries.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (RevenueSummary1?.setOrganization) {
    await RevenueSummary1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const RevenueSummary2 = await RevenueSummaries.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (RevenueSummary2?.setOrganization) {
    await RevenueSummary2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const RevenueSummary3 = await RevenueSummaries.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (RevenueSummary3?.setOrganization) {
    await RevenueSummary3.setOrganization(relatedOrganization3);
  }
}

async function associateSubscriberActivityWithSubscriber() {
  const relatedSubscriber0 = await Subscribers.findOne({
    offset: Math.floor(Math.random() * (await Subscribers.count())),
  });
  const SubscriberActivity0 = await SubscriberActivities.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (SubscriberActivity0?.setSubscriber) {
    await SubscriberActivity0.setSubscriber(relatedSubscriber0);
  }

  const relatedSubscriber1 = await Subscribers.findOne({
    offset: Math.floor(Math.random() * (await Subscribers.count())),
  });
  const SubscriberActivity1 = await SubscriberActivities.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (SubscriberActivity1?.setSubscriber) {
    await SubscriberActivity1.setSubscriber(relatedSubscriber1);
  }

  const relatedSubscriber2 = await Subscribers.findOne({
    offset: Math.floor(Math.random() * (await Subscribers.count())),
  });
  const SubscriberActivity2 = await SubscriberActivities.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (SubscriberActivity2?.setSubscriber) {
    await SubscriberActivity2.setSubscriber(relatedSubscriber2);
  }

  const relatedSubscriber3 = await Subscribers.findOne({
    offset: Math.floor(Math.random() * (await Subscribers.count())),
  });
  const SubscriberActivity3 = await SubscriberActivities.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (SubscriberActivity3?.setSubscriber) {
    await SubscriberActivity3.setSubscriber(relatedSubscriber3);
  }
}

async function associateSubscriberActivityWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const SubscriberActivity0 = await SubscriberActivities.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (SubscriberActivity0?.setOrganization) {
    await SubscriberActivity0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const SubscriberActivity1 = await SubscriberActivities.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (SubscriberActivity1?.setOrganization) {
    await SubscriberActivity1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const SubscriberActivity2 = await SubscriberActivities.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (SubscriberActivity2?.setOrganization) {
    await SubscriberActivity2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const SubscriberActivity3 = await SubscriberActivities.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (SubscriberActivity3?.setOrganization) {
    await SubscriberActivity3.setOrganization(relatedOrganization3);
  }
}

async function associateSubscriberRoleWithSubscriber() {
  const relatedSubscriber0 = await Subscribers.findOne({
    offset: Math.floor(Math.random() * (await Subscribers.count())),
  });
  const SubscriberRole0 = await SubscriberRoles.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (SubscriberRole0?.setSubscriber) {
    await SubscriberRole0.setSubscriber(relatedSubscriber0);
  }

  const relatedSubscriber1 = await Subscribers.findOne({
    offset: Math.floor(Math.random() * (await Subscribers.count())),
  });
  const SubscriberRole1 = await SubscriberRoles.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (SubscriberRole1?.setSubscriber) {
    await SubscriberRole1.setSubscriber(relatedSubscriber1);
  }

  const relatedSubscriber2 = await Subscribers.findOne({
    offset: Math.floor(Math.random() * (await Subscribers.count())),
  });
  const SubscriberRole2 = await SubscriberRoles.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (SubscriberRole2?.setSubscriber) {
    await SubscriberRole2.setSubscriber(relatedSubscriber2);
  }

  const relatedSubscriber3 = await Subscribers.findOne({
    offset: Math.floor(Math.random() * (await Subscribers.count())),
  });
  const SubscriberRole3 = await SubscriberRoles.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (SubscriberRole3?.setSubscriber) {
    await SubscriberRole3.setSubscriber(relatedSubscriber3);
  }
}

async function associateSubscriberRoleWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const SubscriberRole0 = await SubscriberRoles.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (SubscriberRole0?.setOrganization) {
    await SubscriberRole0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const SubscriberRole1 = await SubscriberRoles.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (SubscriberRole1?.setOrganization) {
    await SubscriberRole1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const SubscriberRole2 = await SubscriberRoles.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (SubscriberRole2?.setOrganization) {
    await SubscriberRole2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const SubscriberRole3 = await SubscriberRoles.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (SubscriberRole3?.setOrganization) {
    await SubscriberRole3.setOrganization(relatedOrganization3);
  }
}

async function associateSubscriberWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Subscriber0 = await Subscribers.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (Subscriber0?.setOrganization) {
    await Subscriber0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Subscriber1 = await Subscribers.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (Subscriber1?.setOrganization) {
    await Subscriber1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Subscriber2 = await Subscribers.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (Subscriber2?.setOrganization) {
    await Subscriber2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Subscriber3 = await Subscribers.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (Subscriber3?.setOrganization) {
    await Subscriber3.setOrganization(relatedOrganization3);
  }
}

async function associateSubscriberWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Subscriber0 = await Subscribers.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (Subscriber0?.setOrganization) {
    await Subscriber0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Subscriber1 = await Subscribers.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (Subscriber1?.setOrganization) {
    await Subscriber1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Subscriber2 = await Subscribers.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (Subscriber2?.setOrganization) {
    await Subscriber2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const Subscriber3 = await Subscribers.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (Subscriber3?.setOrganization) {
    await Subscriber3.setOrganization(relatedOrganization3);
  }
}

async function associateSupportTicketWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const SupportTicket0 = await SupportTickets.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (SupportTicket0?.setOrganization) {
    await SupportTicket0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const SupportTicket1 = await SupportTickets.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (SupportTicket1?.setOrganization) {
    await SupportTicket1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const SupportTicket2 = await SupportTickets.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (SupportTicket2?.setOrganization) {
    await SupportTicket2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const SupportTicket3 = await SupportTickets.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (SupportTicket3?.setOrganization) {
    await SupportTicket3.setOrganization(relatedOrganization3);
  }
}

async function associateSupportTicketWithAssigned_to() {
  const relatedAssigned_to0 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const SupportTicket0 = await SupportTickets.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (SupportTicket0?.setAssigned_to) {
    await SupportTicket0.setAssigned_to(relatedAssigned_to0);
  }

  const relatedAssigned_to1 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const SupportTicket1 = await SupportTickets.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (SupportTicket1?.setAssigned_to) {
    await SupportTicket1.setAssigned_to(relatedAssigned_to1);
  }

  const relatedAssigned_to2 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const SupportTicket2 = await SupportTickets.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (SupportTicket2?.setAssigned_to) {
    await SupportTicket2.setAssigned_to(relatedAssigned_to2);
  }

  const relatedAssigned_to3 = await Users.findOne({
    offset: Math.floor(Math.random() * (await Users.count())),
  });
  const SupportTicket3 = await SupportTickets.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (SupportTicket3?.setAssigned_to) {
    await SupportTicket3.setAssigned_to(relatedAssigned_to3);
  }
}

async function associateSupportTicketWithOrganization() {
  const relatedOrganization0 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const SupportTicket0 = await SupportTickets.findOne({
    order: [['id', 'ASC']],
    offset: 0,
  });
  if (SupportTicket0?.setOrganization) {
    await SupportTicket0.setOrganization(relatedOrganization0);
  }

  const relatedOrganization1 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const SupportTicket1 = await SupportTickets.findOne({
    order: [['id', 'ASC']],
    offset: 1,
  });
  if (SupportTicket1?.setOrganization) {
    await SupportTicket1.setOrganization(relatedOrganization1);
  }

  const relatedOrganization2 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const SupportTicket2 = await SupportTickets.findOne({
    order: [['id', 'ASC']],
    offset: 2,
  });
  if (SupportTicket2?.setOrganization) {
    await SupportTicket2.setOrganization(relatedOrganization2);
  }

  const relatedOrganization3 = await Organizations.findOne({
    offset: Math.floor(Math.random() * (await Organizations.count())),
  });
  const SupportTicket3 = await SupportTickets.findOne({
    order: [['id', 'ASC']],
    offset: 3,
  });
  if (SupportTicket3?.setOrganization) {
    await SupportTicket3.setOrganization(relatedOrganization3);
  }
}

module.exports = {
  up: async (queryInterface, Sequelize) => {
    await AccessRoles.bulkCreate(AccessRolesData);

    await AiAgents.bulkCreate(AiAgentsData);

    await Alerts.bulkCreate(AlertsData);

    await AutomationJobs.bulkCreate(AutomationJobsData);

    await Campaigns.bulkCreate(CampaignsData);

    await ComplianceAudits.bulkCreate(ComplianceAuditsData);

    await ComplianceIssues.bulkCreate(ComplianceIssuesData);

    await ExpansionPlans.bulkCreate(ExpansionPlansData);

    await InfrastructureStatuses.bulkCreate(InfrastructureStatusesData);

    await Invoices.bulkCreate(InvoicesData);

    await MarketSignals.bulkCreate(MarketSignalsData);

    await OnboardingCases.bulkCreate(OnboardingCasesData);

    await PatientMessages.bulkCreate(PatientMessagesData);

    await PatientProfiles.bulkCreate(PatientProfilesData);

    await PlatformMetrics.bulkCreate(PlatformMetricsData);

    await PricingStrategies.bulkCreate(PricingStrategiesData);

    await RevenueSummaries.bulkCreate(RevenueSummariesData);

    await SubscriberActivities.bulkCreate(SubscriberActivitiesData);

    await SubscriberRoles.bulkCreate(SubscriberRolesData);

    await Subscribers.bulkCreate(SubscribersData);

    await SupportTickets.bulkCreate(SupportTicketsData);

    await Organizations.bulkCreate(OrganizationsData);

    await Promise.all([
      // Similar logic for "relation_many"

      await associateUserWithOrganization(),

      await associateAccessRoleWithOrganization(),

      await associateAiAgentWithOrganization(),

      await associateAiAgentWithOrganization(),

      await associateAlertWithOrganization(),

      await associateAlertWithOrganization(),

      await associateAutomationJobWithOrganization(),

      await associateAutomationJobWithOrganization(),

      await associateCampaignWithOrganization(),

      await associateCampaignWithOrganization(),

      await associateComplianceAuditWithOrganization(),

      await associateComplianceAuditWithOwner(),

      await associateComplianceAuditWithOrganization(),

      await associateComplianceIssueWithOrganization(),

      await associateComplianceIssueWithOwner(),

      await associateComplianceIssueWithOrganization(),

      await associateExpansionPlanWithOrganization(),

      await associateExpansionPlanWithOrganization(),

      await associateInfrastructureStatusWithOrganization(),

      await associateInfrastructureStatusWithOrganization(),

      await associateInvoiceWithOrganization(),

      await associateInvoiceWithDoctor(),

      await associateInvoiceWithOrganization(),

      await associateMarketSignalWithOrganization(),

      await associateMarketSignalWithOrganization(),

      await associateOnboardingCaseWithOrganization(),

      await associateOnboardingCaseWithUser(),

      await associateOnboardingCaseWithAssigned_staff(),

      await associateOnboardingCaseWithOrganization(),

      await associatePatientMessageWithOrganization(),

      await associatePatientProfileWithSubscriber(),

      await associatePatientProfileWithOrganization(),

      await associatePlatformMetricWithOrganization(),

      await associatePlatformMetricWithOrganization(),

      await associatePricingStrategyWithOrganization(),

      await associatePricingStrategyWithOrganization(),

      await associateRevenueSummaryWithOrganization(),

      await associateRevenueSummaryWithOrganization(),

      await associateSubscriberActivityWithSubscriber(),

      await associateSubscriberActivityWithOrganization(),

      await associateSubscriberRoleWithSubscriber(),

      await associateSubscriberRoleWithOrganization(),

      await associateSubscriberWithOrganization(),

      await associateSubscriberWithOrganization(),

      await associateSupportTicketWithOrganization(),

      await associateSupportTicketWithAssigned_to(),

      await associateSupportTicketWithOrganization(),
    ]);
  },

  down: async (queryInterface, Sequelize) => {
    await queryInterface.bulkDelete('access_roles', null, {});

    await queryInterface.bulkDelete('ai_agents', null, {});

    await queryInterface.bulkDelete('alerts', null, {});

    await queryInterface.bulkDelete('automation_jobs', null, {});

    await queryInterface.bulkDelete('campaigns', null, {});

    await queryInterface.bulkDelete('compliance_audits', null, {});

    await queryInterface.bulkDelete('compliance_issues', null, {});

    await queryInterface.bulkDelete('expansion_plans', null, {});

    await queryInterface.bulkDelete('infrastructure_statuses', null, {});

    await queryInterface.bulkDelete('invoices', null, {});

    await queryInterface.bulkDelete('market_signals', null, {});

    await queryInterface.bulkDelete('onboarding_cases', null, {});

    await queryInterface.bulkDelete('patient_messages', null, {});

    await queryInterface.bulkDelete('patient_profiles', null, {});

    await queryInterface.bulkDelete('platform_metrics', null, {});

    await queryInterface.bulkDelete('pricing_strategies', null, {});

    await queryInterface.bulkDelete('revenue_summaries', null, {});

    await queryInterface.bulkDelete('subscriber_activities', null, {});

    await queryInterface.bulkDelete('subscriber_roles', null, {});

    await queryInterface.bulkDelete('subscribers', null, {});

    await queryInterface.bulkDelete('support_tickets', null, {});

    await queryInterface.bulkDelete('organizations', null, {});
  },
};
