export type GuruTicketStatus = "OPEN" | "RESOLVED" | "ESCALATED";
export type GuruActionStatus =
  | "PENDING"
  | "EXECUTED"
  | "FAILED"
  | "DECLINED"
  | "EXPIRED"
  | "REFUSED";

export interface GuruTicket {
  id: string;
  reference: string;
  console_user_id: string;
  concierge_email: string;
  member_ref: string | null;
  category: string | null;
  status: GuruTicketStatus;
  resolution: "AUTO_RESOLVED" | "ESCALATED" | null;
  summary: string | null;
  clickup_task_id: string | null;
  clickup_task_url: string | null;
  conversation_ids: string[];
  created_at: string;
  updated_at: string | null;
  resolved_at: string | null;
}

export interface GuruPendingAction {
  id: string;
  ticket_id: string;
  conversation_id: string;
  action_type: string;
  member_ref: string;
  params: unknown | null;
  summary: string;
  status: GuruActionStatus;
  confirmed_by: string | null;
  result: unknown | null;
  error: string | null;
  expires_at: string;
  created_at: string;
  executed_at: string | null;
}

export interface GuruAllowlistEntry {
  id: string;
  email: string;
  added_by: string;
  created_at: string;
}

export interface GuruAuditEntry {
  id: string;
  ticket_id: string | null;
  action_id: string | null;
  action: string;
  actor_email: string | null;
  confirmed_by: string | null;
  member_ref: string | null;
  before: unknown | null;
  after: unknown | null;
  clickup_task_id: string | null;
  success: boolean | null;
  metadata: unknown | null;
  created_at: string;
}

export interface GuruTicketFilters {
  statuses?: GuruTicketStatus[];
  category?: string;
  search?: string;
  page?: number;
  limit?: number;
}
