# cstats Bash Hook
# Generated automatically - do not edit manually
# Shell: {{shell_type}}
# Default source: {{default_source}}

# Environment variables
{{env_vars}}

# Core cstats wrapper function
cstats_wrap() {
    local cmd="$*"
    {{cstats_path}} collect --source "{{default_source}}" --command "$cmd"
}

# Convenient alias for manual usage
alias cs='cstats_wrap'

# Auto-wrapped commands
{{auto_commands}}

# Utility functions
cstats_recent() {
    local hours=${1:-1}
    local start_time=$(date -d "${hours} hours ago" -Iseconds)
    {{cstats_path}} analyze --source "{{default_source}}" --start-time "$start_time"
}

cstats_today() {
    local start_time=$(date -d "today 00:00" -Iseconds)
    {{cstats_path}} analyze --source "{{default_source}}" --start-time "$start_time"
}

cstats_clear_cache() {
    {{cstats_path}} cache clear
}

cstats_status() {
    {{cstats_path}} cache stats
}

# Advanced: Auto-collect all commands (if enabled)
{{#if auto_collect_all}}
# CAUTION: This will collect statistics for ALL commands
# Uncomment the following line to enable:
# trap 'cstats collect --source "{{default_source}}" --command "$BASH_COMMAND" &' DEBUG
{{/if}}

echo "✓ cstats {{shell_type}} hook loaded. Use 'cs <command>' to collect statistics."