// Package services provides service client interfaces for inter-service communication.
package services

import (
	"context"
)

// AuditServiceClient is the interface for communicating with the Audit Service.
type AuditServiceClient interface {
	// Record records an audit log entry.
	Record(ctx context.Context, entry *AuditLogEntry) error

	// Query queries audit logs based on filters.
	Query(ctx context.Context, filters *AuditLogFilters) ([]AuditLogEntry, error)
}

// AuditLogEntry represents an audit log entry.
type AuditLogEntry struct {
	UserID     string            `json:"user_id"`
	Action     string            `json:"action"`   // e.g., "user.create", "user.update"
	Resource   string            `json:"resource"` // e.g., "user", "role"
	ResourceID string            `json:"resource_id"`
	IPAddress  string            `json:"ip_address"`
	UserAgent  string            `json:"user_agent"`
	Metadata   map[string]string `json:"metadata"`
	Timestamp  int64             `json:"timestamp"`
}

// AuditLogFilters contains filters for querying audit logs.
type AuditLogFilters struct {
	UserID     *string `json:"user_id,omitempty"`
	Action     *string `json:"action,omitempty"`
	Resource   *string `json:"resource,omitempty"`
	ResourceID *string `json:"resource_id,omitempty"`
	StartTime  *int64  `json:"start_time,omitempty"`
	EndTime    *int64  `json:"end_time,omitempty"`
	Limit      int     `json:"limit"`  // Max number of results
	Offset     int     `json:"offset"` // Pagination offset
}
