export type AuditLogStatus = "success" | "failure"

export type LoginLogAction = "signin" | "signout" | "signup"
export type LoginLogStatus = "success" | "failure"

export type DataChangeAction = "create" | "update" | "delete"

export interface AuditLog {
  id: string
  userId: string
  userName: string
  action: string
  module: string
  targetId: string | null
  targetType: string | null
  detail: string | null
  ipAddress: string | null
  userAgent: string | null
  status: AuditLogStatus
  createdAt: string
}

export interface LoginLog {
  id: string
  userId: string | null
  userEmail: string
  action: LoginLogAction
  status: LoginLogStatus
  ipAddress: string | null
  userAgent: string | null
  errorMessage: string | null
  createdAt: string
}

export interface DataChangeLog {
  id: string
  tableName: string
  recordId: string
  action: DataChangeAction
  oldValue: string | null
  newValue: string | null
  changedBy: string
  changedByName: string
  ipAddress: string | null
  createdAt: string
}

export interface DataChangeStat {
  tableName: string
  count: number
}

export interface AuditLogQueryParams {
  userId?: string
  module?: string
  action?: string
  status?: AuditLogStatus
  page?: number
  pageSize?: number
  startDate?: string
  endDate?: string
}

export interface LoginLogQueryParams {
  userId?: string
  action?: LoginLogAction
  status?: LoginLogStatus
  page?: number
  pageSize?: number
  startDate?: string
  endDate?: string
}

export interface DataChangeLogQueryParams {
  tableName?: string
  recordId?: string
  action?: DataChangeAction
  userId?: string
  page?: number
  pageSize?: number
  startDate?: string
  endDate?: string
}

export interface PaginatedResult<T> {
  items: T[]
  total: number
  page: number
  pageSize: number
  totalPages: number
}
