# NATS Service Definition for provctl
#
# This file defines how NATS is managed by provctl.
# NATS is used for event-driven agent communication in syntaxis.
# Usage: provctl deploy --config configs/provisioning/services/nats.toml

[service]
name = "nats"
description = "NATS JetStream - Cloud-native message broker"

# Binary to execute
binary = "nats-server"

# Arguments for the service
args = [
    "--config", "~/.config/nats/nats-server.conf"
]

# Working directory
working_dir = "~/.local/share/nats"

# Environment variables
[service.env]
# NATS logging
NATS_LOG_FILE = "~/.local/share/nats/nats.log"
NATS_LOG_LEVEL = "info"

# Logging configuration
[logging]
log_file = "~/.local/share/nats/nats.log"
level = "info"
max_backups = 10

# Health check configuration
[health_check]
type = "tcp"
address = "127.0.0.1"
port = 4222
interval_secs = 10
timeout_secs = 5
failure_threshold = 3
success_threshold = 2

# Resource limits
[resources]
memory_limit_mb = 256
cpu_limit = 0
file_descriptor_limit = 2048

# Restart policy
[restart]
policy = "on-failure"
max_retries = 5
delay_secs = 2
backoff_multiplier = 1.5

# Dependencies
[dependencies]
wait_for = []

# Notes
[notes]
installation_required = "nats-server"
installation_command = "brew install nats-io/nats-server/nats-server (macOS) or apt-get install nats-server (Linux)"
documentation = "https://docs.nats.io/"
optional = true  # NATS is optional for basic syntaxis operation

# Platform-specific configurations
[platform.linux]
binary = "nats-server"

[platform.macos]
binary = "nats-server"

[platform.windows]
binary = "nats-server.exe"
