package domain

import (
	"context"
	"time"
)

// AuditLog represents a single audit event
type AuditLog struct {
	EventID   string    `json:"event_id"`
	Timestamp time.Time `json:"timestamp"`
	UserID    string    `json:"user_id"`
	EventType string    `json:"event_type"` // e.g., "login_success", "login_failed", "otp_sent"
	Status    string    `json:"status"`     // e.g., "success", "failure"
	IPAddress string    `json:"ip_address"`
	UserAgent string    `json:"user_agent"`
	DeviceID  string    `json:"device_id,omitempty"`
	Details   string    `json:"details,omitempty"` // JSON string or simple text
}

// AuditRepository defines interface for storing logs
type AuditRepository interface {
	Create(log *AuditLog) error
	FindPage(ctx context.Context, limit int, cursor *AuditCursor) ([]AuditLog, error)
	Ping(ctx context.Context) error
}

type AuditCursor struct {
	Timestamp time.Time
	EventID   string
}
