/**
 * Webhook API Models
 * Models for webhook management
 */

export type WebhookEvent =
  | 'APPROVAL_REQUIRED'
  | 'DOCUMENT_UPDATED'
  | 'REQUEST_APPROVED'
  | 'REQUEST_REJECTED'
  | 'CHANGES_REQUESTED'
  | 'LICENSE_MINTED'
  | 'LICENSE_REVOKED';

export interface CreateWebhookDto {
  url: string;
  events: WebhookEvent[];
  description?: string;
}

export interface UpdateWebhookDto {
  url?: string;
  events?: WebhookEvent[];
  isActive?: boolean;
  description?: string;
}

export interface WebhookResponseDto {
  id: string;
  departmentId: string;
  url: string;
  events: WebhookEvent[];
  isActive: boolean;
  description?: string;
  createdAt: string;
  updatedAt: string;
}

export interface WebhookTestResultDto {
  success: boolean;
  statusCode: number;
  statusMessage: string;
  responseTime: number;
  error?: string;
}

export interface WebhookLogEntryDto {
  id: string;
  webhookId: string;
  event: WebhookEvent;
  payload: Record<string, any>;
  statusCode: number;
  response?: string;
  error?: string;
  responseTime: number;
  timestamp: string;
  retryCount: number;
}

export interface PaginatedWebhookLogsResponse {
  data: WebhookLogEntryDto[];
  total: number;
  page: number;
  limit: number;
  totalPages: number;
  hasNextPage: boolean;
}
