// Package port defines interfaces (ports) for external dependencies.
package port

import "context"

// CitadelEnvironment represents a Citadel log environment.
type CitadelEnvironment struct {
	// TenantID is the unique identifier for this environment in Citadel.
	TenantID string `json:"tenant_id"`
	// Name is the human-readable environment name.
	Name string `json:"name"`
}

// CitadelClient manages Citadel environments and log shipping.
type CitadelClient interface {
	// CreateEnvironment creates a new Citadel environment for a project.
	// Returns the tenant ID for the new environment.
	CreateEnvironment(ctx context.Context, name string) (*CitadelEnvironment, error)

	// DeleteEnvironment removes a Citadel environment.
	DeleteEnvironment(ctx context.Context, tenantID string) error

	// GetEnvironment returns an environment by name.
	// Returns nil, nil if not found.
	GetEnvironment(ctx context.Context, name string) (*CitadelEnvironment, error)

	// IngestEvent sends a single log event to Citadel.
	IngestEvent(ctx context.Context, tenantID string, event map[string]any) error

	// IngestBatch sends a batch of log events to Citadel.
	IngestBatch(ctx context.Context, tenantID string, events []map[string]any) error

	// Healthy returns true if the Citadel instance is reachable.
	Healthy(ctx context.Context) bool
}
