export interface HijackEvent {
  id: number
  asn: number
  prefix: string
  detected_at: Date
  expected_asn: number
  detected_asns: number[]
  hijack_type: 'MOAS' | 'HIJACK' | 'LEAK'
  severity: 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW'
  description: string
  details: Record<string, unknown>
  resolved: boolean
  resolved_at: Date | null
  created_at: Date
}

export interface WebhookSubscription {
  id: number
  asn: number
  endpoint_url: string
  secret_key: string
  created_at: Date
  last_triggered_at: Date | null
  failure_count: number
  active: boolean
  max_retries: number
  timeout_ms: number
  metadata: Record<string, unknown>
}

export interface WebhookDelivery {
  id: number
  subscription_id: number
  event_id: number
  attempt_number: number
  sent_at: Date
  response_status: number | null
  response_body: string | null
  error_message: string | null
  next_retry_at: Date | null
}

export interface CreateHijackEventInput {
  asn: number
  prefix: string
  expected_asn: number
  detected_asns: number[]
  hijack_type: 'MOAS' | 'HIJACK' | 'LEAK'
  severity: 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW'
  description: string
  details: Record<string, unknown>
}

export interface CreateWebhookInput {
  asn: number
  endpoint_url: string
  timeout_ms?: number
  max_retries?: number
}

export interface WebhookPayload {
  event: HijackEvent
  timestamp: string
  signature: string
}

export interface ResolveHijackInput {
  resolution_notes: string
}
