// API Response Types
export interface User {
  id: string;
  username: string;
  email: string;
  full_name?: string;
  role: 'admin' | 'user';
  active: boolean;
  created_at: string;
  updated_at: string;
}

export interface Hook {
  id: string;
  user_id: string;
  name: string;
  url: string;
  method: string;
  headers?: string; // JSON string
  events?: string; // JSON string
  description?: string;
  secret?: string;
  retry_count: number;
  timeout: number;
  active: boolean;
  created_at: string;
  updated_at: string;
}

export interface WhatsAppAccount {
  id: string;
  user_id: string;
  account_id?: string; // User-friendly unique identifier
  phone_number: string;
  display_name?: string;
  account_type: 'whatsmeow' | 'business-api';
  status: 'connected' | 'disconnected' | 'connecting';
  config?: string; // JSON string
  session_path?: string;
  last_connected_at?: string;
  active: boolean;
  created_at: string;
  updated_at: string;
}

export interface EventLog {
  id: string;
  user_id?: string;
  event_type: string;
  action?: string;
  entity_type?: string;
  entity_id?: string;
  data?: string; // JSON string
  success: boolean;
  error?: string;
  ip_address?: string;
  user_agent?: string;
  created_at: string;
}

export interface APIKey {
  id: string;
  user_id: string;
  name: string;
  key: string;
  key_prefix?: string;
  permissions?: string; // JSON string
  expires_at?: string;
  last_used_at?: string;
  active: boolean;
  created_at: string;
  updated_at: string;
}

export interface Session {
  id: string;
  user_id: string;
  token: string;
  ip_address?: string;
  user_agent?: string;
  expires_at: string;
  created_at: string;
  updated_at: string;
}

// Auth Types
export interface LoginRequest {
  username: string;
  password: string;
}

export interface LoginResponse {
  token: string;
  user: User;
  expires_in: number;
}

// API Response wrappers
export interface ApiResponse<T> {
  data?: T;
  error?: string;
  message?: string;
}

export interface PaginatedResponse<T> {
  data: T[];
  total: number;
  page: number;
  per_page: number;
}
