/** Mock até API VM122 hub (F1-F2) */
export const MOCK_CHAMADO = {
  public_id: 'CH-2026-00042',
  status: 'em_correcao',
  domain: 'myvexx.com',
  assignee: 'ops_lead',
  sources: ['onboard', 'wazuh'],
  max_severity: 12,
  assist: {
    wizard_step_label: 'DNS Cloudflare',
    time_on_step_sec: 142,
    last_error: 'timeout apply records',
    planned_email: 'admin@myvexx.com',
  },
  observables: [
    { tipo: 'domain', valor: 'myvexx.com', fonte: 'onboard' },
    { tipo: 'agent', valor: 'vm112-mail', fonte: 'wazuh' },
    { tipo: 'rule_id', valor: '5712', fonte: 'wazuh' },
  ],
  timeline: [
    { event_type: 'wazuh.alert', source: 'wazuh', summary: 'L12 SSH brute force', created_at: '2026-06-16T10:00:00Z', severity: 12 },
    { event_type: 'onboarding.failed', source: 'onboard', summary: 'DNS apply timeout', created_at: '2026-06-16T10:05:00Z' },
    { event_type: 'nota', source: 'ops', summary: 'Assumido por NOC', created_at: '2026-06-16T10:08:00Z' },
  ],
  links: { wazuh_deep_link: 'https://wazuh.itecnologys.com/' },
}

export const MOCK_CHAMADOS = [
  { public_id: 'CH-2026-00042', status: 'em_correcao', domain: 'myvexx.com', sources: ['onboard', 'wazuh'], max_severity: 12 },
  { public_id: 'CH-2026-00041', status: 'novo', domain: 'diarissima.com', sources: ['onboard'], max_severity: null },
]

export const MOCK_EVENTS = [
  { id: 901, chamado_public_id: 'CH-2026-00042', source: 'wazuh', event_type: 'wazuh.alert', domain: 'myvexx.com', severity: 12, summary: 'SSH brute force', agent: 'vm112-mail', rule_id: '5712', created_at: new Date(Date.now() - 3600000).toISOString() },
  { id: 902, chamado_public_id: 'CH-2026-00042', source: 'onboard', event_type: 'onboarding.failed', domain: 'myvexx.com', severity: null, summary: 'DNS timeout', agent: '—', rule_id: null, created_at: new Date(Date.now() - 3000000).toISOString() },
]

/** Alertas Wazuh últimas 24h — alimentam barra + Discover filtrável */
export const MOCK_DISCOVER_EVENTS = [
  { id: 1001, source: 'wazuh', event_type: 'wazuh.alert', domain: 'myvexx.com', severity: 9, summary: 'Integrity checksum changed', agent: 'vm112-mail', rule_id: '550', chamado_public_id: null, created_at: new Date(Date.now() - 2 * 3600000).toISOString() },
  { id: 1002, source: 'wazuh', event_type: 'wazuh.alert', domain: 'ligbox.com.br', severity: 8, summary: 'Multiple authentication failures', agent: 'vm123-finance', rule_id: '5710', chamado_public_id: null, created_at: new Date(Date.now() - 5 * 3600000).toISOString() },
  { id: 1003, source: 'wazuh', event_type: 'wazuh.alert', domain: '—', severity: 5, summary: 'sshd: authentication failure', agent: 'vm122-desk', rule_id: '5712', chamado_public_id: null, created_at: new Date(Date.now() - 1 * 3600000).toISOString() },
  { id: 1004, source: 'wazuh', event_type: 'wazuh.alert', domain: '—', severity: 4, summary: 'PAM: User login failed', agent: 'vm122-desk', rule_id: '5503', chamado_public_id: null, created_at: new Date(Date.now() - 3 * 3600000).toISOString() },
  { id: 1005, source: 'wazuh', event_type: 'wazuh.alert', domain: '—', severity: 3, summary: 'New Yum package installed', agent: 'vm104-wazuh', rule_id: '23504', chamado_public_id: null, created_at: new Date(Date.now() - 6 * 3600000).toISOString() },
  { id: 1006, source: 'wazuh', event_type: 'wazuh.alert', domain: '—', severity: 3, summary: 'Listened ports status changed', agent: 'traefik-proxy', rule_id: '533', chamado_public_id: null, created_at: new Date(Date.now() - 8 * 3600000).toISOString() },
  { id: 1007, source: 'wazuh', event_type: 'wazuh.alert', domain: '—', severity: 2, summary: 'syslog: cron session opened', agent: 'vm112-mail', rule_id: '2833', chamado_public_id: null, created_at: new Date(Date.now() - 10 * 3600000).toISOString() },
  { id: 1008, source: 'wazuh', event_type: 'wazuh.alert', domain: '—', severity: 2, summary: 'File added to the system', agent: 'vm123-finance', rule_id: '554', chamado_public_id: null, created_at: new Date(Date.now() - 12 * 3600000).toISOString() },
  { id: 1009, source: 'wazuh', event_type: 'wazuh.alert', domain: '—', severity: 2, summary: 'Dpkg (Debian Package) changed', agent: 'vm122-desk', rule_id: '2902', chamado_public_id: null, created_at: new Date(Date.now() - 14 * 3600000).toISOString() },
  { id: 1010, source: 'wazuh', event_type: 'wazuh.alert', domain: '—', severity: 1, summary: 'Login session opened', agent: 'vm104-wazuh', rule_id: '5501', chamado_public_id: null, created_at: new Date(Date.now() - 16 * 3600000).toISOString() },
  { id: 1011, source: 'wazuh', event_type: 'wazuh.alert', domain: '—', severity: 1, summary: 'PAM: Login session closed', agent: 'traefik-proxy', rule_id: '5502', chamado_public_id: null, created_at: new Date(Date.now() - 18 * 3600000).toISOString() },
  { id: 1012, source: 'wazuh', event_type: 'wazuh.alert', domain: '—', severity: 1, summary: 'sshd: Accepted publickey', agent: 'vm112-mail', rule_id: '5715', chamado_public_id: null, created_at: new Date(Date.now() - 20 * 3600000).toISOString() },
  { id: 1013, source: 'wazuh', event_type: 'wazuh.alert', domain: '—', severity: 0, summary: 'Agent started', agent: 'vm122-desk', rule_id: '503', chamado_public_id: null, created_at: new Date(Date.now() - 22 * 3600000).toISOString() },
  { id: 1014, source: 'wazuh', event_type: 'wazuh.alert', domain: '—', severity: 0, summary: 'Agent keepalive', agent: 'vm123-finance', rule_id: '504', chamado_public_id: null, created_at: new Date(Date.now() - 23 * 3600000).toISOString() },
  { id: 902, chamado_public_id: 'CH-2026-00042', source: 'onboard', event_type: 'onboarding.failed', domain: 'myvexx.com', severity: null, summary: 'DNS timeout', agent: '—', rule_id: null, created_at: new Date(Date.now() - 3000000).toISOString() },
]

export const MOCK_TENANTS = [
  { id: 1, name: 'VM112 Onboard / Carbonio', ip: '10.10.10.112', role: 'onboarding_mail', created_at: '2026-06-08T00:00:00Z' },
  { id: 2, name: 'VM122 Ligbox Ops', ip: '10.10.10.122', role: 'ops_api', created_at: '2026-06-08T00:00:00Z' },
  { id: 3, name: 'VM104 Wazuh', ip: '10.10.10.104', role: 'soc', created_at: '2026-06-08T00:00:00Z' },
  { id: 4, name: 'VM123 Finance', ip: '10.10.10.123', role: 'billing', created_at: '2026-06-17T00:00:00Z' },
]

export const MOCK_AUDIT_TENANTS = [
  { id: 'vm112', label: 'VM112 Mail', kind: 'carbonio', score: 7, domain: 'onboard.ligbox.com.br' },
  { id: 'wazuh', label: 'Wazuh SOC', kind: 'wazuh_soc', score: 8 },
  { id: 'demo', label: 'cenario-demo.ops.ligbox.com.br', kind: 'domain', score: 6, domain: 'cenario-demo.ops.ligbox.com.br' },
]

export const MOCK_SUMMARY = {
  tickets_open: 4,
  tickets_escalated: 1,
  tickets_assisting: 2,
  tickets_closed: 18,
  webhook_events: 142,
  wazuh_events: 89,
  tenants: 4,
  billing_pending: 2,
  billing_active: 11,
}

/** Formato /api/v1/audit/overview — espelha VM122 audit_store */
export const MOCK_AUDIT_OVERVIEW = {
  generated_at: '2026-06-25T12:00:00Z',
  tenants: [
    {
      tenant_id: 1,
      name: 'VM112 Onboard / Carbonio',
      ip: '10.10.10.112',
      status: 'degraded',
      score: { pass: 7, warn: 1, fail: 0, total: 8 },
      domains_count: 3,
      last_audit_at: '2026-06-25T08:30:00Z',
      top_issues: [
        { domain: 'myvexx.com', check_id: 'dmarc', message: 'DMARC policy none', status: 'warn' },
        { domain: 'diarissima.com', check_id: 'tls_webmail', message: 'cert expira em 12d', status: 'warn' },
      ],
    },
    {
      tenant_id: 2,
      name: 'VM122 Ligbox Ops',
      ip: '10.10.10.122',
      status: 'healthy',
      score: { pass: 8, warn: 0, fail: 0, total: 8 },
      domains_count: 2,
      last_audit_at: '2026-06-25T09:00:00Z',
      top_issues: [],
    },
    {
      tenant_id: 3,
      name: 'VM104 Wazuh SOC',
      ip: '10.10.10.104',
      kind: 'wazuh_soc',
      status: 'healthy',
      score: { pass: 8, warn: 0, fail: 0, total: 8 },
      alerts_count: 14,
      max_level: 9,
      domains_count: 0,
      top_issues: [],
    },
    {
      tenant_id: 4,
      name: 'cenario-demo',
      ip: '10.10.10.112',
      status: 'critical',
      score: { pass: 4, warn: 2, fail: 2, total: 8 },
      domains_count: 1,
      last_audit_at: '2026-06-24T22:00:00Z',
      top_issues: [
        { domain: 'cenario-demo.ops.ligbox.com.br', check_id: 'mx', message: 'MX não resolve', status: 'fail' },
        { domain: 'cenario-demo.ops.ligbox.com.br', check_id: 'spf', message: 'SPF missing', status: 'fail' },
      ],
    },
  ],
}

export const MOCK_INCIDENTS = [
  {
    id: 1,
    scenario_id: 'desk.api.health',
    title: 'desk.api.health — HTTP 502 upstream',
    severity: 'critical',
    status: 'open',
    occurrence_count: 3,
    last_seen_at: '2026-06-25T11:40:00Z',
  },
  {
    id: 2,
    scenario_id: 'onboard.dns.stale',
    title: 'Onboard DNS apply stale > 2h',
    severity: 'warn',
    status: 'open',
    occurrence_count: 1,
    last_seen_at: '2026-06-25T10:15:00Z',
  },
]
