import { request } from '@/api/request'

export interface RawEvent {
  id: number
  created_at: string
  updated_at: string
  source_type: string
  resource_uid: string
  event_time: string
  severity: string
  title: string
  message: string
  labels: string
  annotations: string
  parse_status: string
  raw_payload: string
  trace_id: string
  alert_record_id: number
  replay_count: number
  last_replayed_at?: string
}

export const fetchRawEvents = (params: {
  page?: number
  page_size?: number
  keyword?: string
  source_type?: string
  resource_uid?: string
  severity?: string
  parse_status?: string
  trace_id?: string
  start_time?: string
  end_time?: string
  sort?: string
  order?: string
}) => request.get('/Alert/v1/raw-events/list', { params })

export const fetchRawEventDetail = (id: number) => request.get(`/Alert/v1/raw-events/get/${id}`)

export const replayRawEvent = (id: number) => request.post(`/Alert/v1/raw-events/replay/${id}`)
